╮(╯▽╰)╭没办法,小妖精Balous也很讨厌学院化的教育呀,一点意义都没有。

  这次就上传东方地灵殿灵梦A逻辑部分的核心代码吧,估计连老师都看不懂。动画部分的代码就不放上来了。

//================================================================
//
// Copyright (C)
// All Rights Reserved
//
// Author:小妖精Balous
//
//================================================================

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Reimu : Player
{
public GameObject reimuBomb;

protected override void Bomb()
{
invincibleTime = 2.6f;
bombTime = 2.6f;

if (reimuBomb != null)
{
Instantiate(reimuBomb, Vector3.zero, Quaternion.identity);
}
}
}

//================================================================
//
// Copyright (C)
// All Rights Reserved
//
// Author:小妖精Balous
//
//================================================================

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ReimuBomb : MonoBehaviour
{
/// <summary>
/// 消弹倒计时
/// </summary>
private float clearTime;

// Use this for initialization
void Start ()
{
clearTime = 2.6f;
}

// Update is called once per frame
void Update ()
{
clearTime -= Time.deltaTime;

if (clearTime <= 0f)
{
if (GameManager.bulletList.Count > 0)
{
for (var bullet = GameManager.bulletList.First; bullet != null;)
{
var next = bullet.Next;
if (bullet.Value.destructible) Destroy(bullet.Value.gameObject);
bullet = next;
}
}
Destroy(gameObject);
}
}
}

//================================================================
//
// Copyright (C)
// All Rights Reserved
//
// Author:小妖精Balous
//
//================================================================

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ReimuSubCraft : SubCraft
{
private static float normalDistance = 1.1f;
private static float slowDistance = 0.47f;

private static float verticalSpeed = 1.2f;
private static float rotateSpeed = -270f;

public override void Move()
{
transform.RotateAround(GameManager.player.transform.position, Vector3.forward, rotateSpeed * Time.deltaTime);
transform.eulerAngles = Vector3.forward;

//计算子机与自机的距离
float distance = Vector2.Distance(new Vector2(transform.position.x, transform.position.y), new Vector2(GameManager.player.transform.position.x, GameManager.player.transform.position.y));

if (Controller.Slow())
{
if (Mathf.Abs(distance - slowDistance) > 0.03f)
{
Vector2 direction = new Vector2(GameManager.player.transform.position.x - transform.position.x, GameManager.player.transform.position.y - transform.position.y).normalized;
transform.Translate(new Vector3(direction.x, direction.y) * Time.deltaTime * verticalSpeed);
}
}

else
{
if (Mathf.Abs(normalDistance - distance) > 0.03f)
{
Vector2 direction = new Vector2(transform.position.x - GameManager.player.transform.position.x, transform.position.y - GameManager.player.transform.position.y).normalized;
transform.Translate(new Vector3(direction.x, direction.y) * Time.deltaTime * verticalSpeed);
}
}
}

public override void NormalShoot()
{
GameObject normalBulletClone = Instantiate(normalBullet, transform.position + new Vector3(-0.04f, 0.2f, 0f), Quaternion.identity);
Destroy(normalBulletClone, 7f);
normalBulletClone = Instantiate(normalBullet, transform.position + new Vector3(0.04f, 0.2f, 0f), Quaternion.identity);
Destroy(normalBulletClone, 7f);
}

public override void SlowShoot()
{
GameObject slowBulletClone = Instantiate(slowBullet, transform.position + new Vector3(-0.04f, 0.2f, 0f), Quaternion.identity);
Destroy(slowBulletClone, 7f);
slowBulletClone = Instantiate(slowBullet, transform.position + new Vector3(0.04f, 0.2f, 0f), Quaternion.identity);
Destroy(slowBulletClone, 7f);
}
}

小妖精的完美游戏教室——东方PROJECT,同人,th12灵梦A的更多相关文章

  1. 小妖精的完美游戏教室——东方project,同人,自机

    //================================================================ //// Copyright (C)// All Rights R ...

  2. 小妖精的完美游戏教室——东方PROJECT,同人,墙

    //================================================================//// Copyright (C) 东方同人社// All Rig ...

  3. 小妖精的完美游戏教室——东方PROJECT,同人,符卡系统

    //================================================================//// Copyright (C) 东方同人社// All Rig ...

  4. 小妖精的完美游戏教室——东方PROJECT,同人,子机

    //================================================================//// Copyright (C)// All Rights Re ...

  5. 小妖精的完美游戏教室——人工智能,A*算法,引言

    今天也要直播魔法,求科学的! 欢迎来到小妖精Balous的完美游戏教室! 经过前两周的学习,相信米娜桑已经对状态机有所了解了呢~虽然状态机能够实现几乎所有的人工智能,但是,在实践中,你们有没有发现,自 ...

  6. 小妖精的完美游戏教室——人工智能,A*算法,启发因子篇

    //================================================================//// Copyright (C) 2017 Team Saluk ...

  7. 小妖精的完美游戏教室——人工智能,A*算法,导航网络篇

    //================================================================//// Copyright (C) 2017 Team Saluk ...

  8. 小妖精的完美游戏教室——人工智能,A*算法,结点篇

    //================================================================//// Copyright (C) 2017 Team Saluk ...

  9. 小妖精的完美游戏教室——人工智能,A*算法,实现篇

    //================================================================//// Copyright (C) 2017 Team Saluk ...

随机推荐

  1. css 技巧 (持续更新)

    1.滚动条样式   /*自定义滚动条-----隐藏型*/ .scroll::-webkit-scrollbar-track{ border-radius: 1px;   }   .scroll::-w ...

  2. linux修改主机名+免密认证+关闭防火墙

    在很多软件安装的时候都有这些需求,因此在这里一起讲一下 修改主机名 简单的使用 hostnamectl 命令就好了 hostnamectl set-hostname NAME 免密认证 准备工作,修改 ...

  3. Apache安装,亲测成功

    工作需要,为一台空白服务器安装apache,小白程序员,搞了一个下午,惭愧! 工具需要,也可以自己到apache下载 http://httpd.apache.org/download.cgi 遇到的b ...

  4. php不用正则表达式实现身份证号验证详解

    写了一个身份证号验证类,php小白,写的不好,欢迎各位大神给我多提意见和建议 身份证号分为四部分,第一部分是前6位为地址码,7-14位是出生日期,15-17位是同一地方同一天出生的男孩为奇数,女孩是偶 ...

  5. 在状态栏增加图标(Android 6.0)

    在Android 启动之后,在SystemServer.java的run方法中,调用了StatusBarManagerService的构造方法,在StatusBarManagerService的构造方 ...

  6. python 保留字符

    False 假的 None 无 True 真的 and 和 as作为 assert 断言 break 打破 class 种类 continue 继续 def del 删除 elif 否则如果 else ...

  7. java 反射与其应用

    前言: 目标:对于我个人而言 我希望能由以下途径达到最终目标  清楚反射的概念以及为什么要用反射技术 -> java的反射技术 -> java反射技术涉及到的类 -> java反射技 ...

  8. 本地pip 源搭建起来

    pip install pip2pi pip2tgz target_dir -r requirement.txt 下载想要的本地的py包  /usr/local/python3/bin/dir2pi ...

  9. 运行Office 2007安装程序提示:"找不到Office.zh-cn\OfficeMUI.xml"(转载)亲测

    去网上查结果原来是Office 2007和Visual Studio 2008 Authoring Component组件相冲突,网上说用VS.Net 2008光盘WCU\WebDesignerCor ...

  10. shell脚本学习总结(不断更新中)

    前言:自从大学毕业参加工作以来,接触的开发工作都是在服务端完成,于是接触了比较多的Linux当做开发机使用,或多或少有一些重复性的工作,于是开始琢磨学习一些shell脚本的知识,以便处理这些繁琐的事情 ...