╮(╯▽╰)╭没办法,小妖精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. js 回调

    function getTittleLableData(callback) { $.ajax({ type : 'POST', url : ctx + '/feeInf/getDataValue', ...

  2. 6 python高级数据处理和可视化

    6.2. pyplot作图 1.折线图和散点图 t = np.arange(0,4,0.1) plt.plot(t,t,'o',t,t+2,t,t**2,'o') plt.show() 2.柱线图 p ...

  3. 指导手册06:HBase安装部署

    指导手册06:HBase安装部署 配置环境 1.参考文件: https://www.cnblogs.com/lzxlfly/p/7221890.html https://www.cnblogs.com ...

  4. explor img file

    1, get offset # parted bone-debian----4gb.img GNU Parted 3.1 Using /workspace/bone-debian----4gb.img ...

  5. 用svm来做回归预测(python)

    ————————————————————***提醒自己结束了就发博客***————————————————————

  6. sprigmvc 传值jsp页面

    https://blog.csdn.net/qq_41357573/article/details/84675535#如何将controller层值传递到jsp页面

  7. JavaScript的局部变量和全局变量小知识

    (了解一下,避免初学者犯错,但下面定义全局变量的做法并不推荐,只是让你们知道这是怎么一回事) 如果在函数中使用var定义一个变量,那么这个变量在函数退出后就会被销毁,例如: function test ...

  8. Vue语法学习第四课(2)——class与style的绑定

    之前学到的指令 v-bind 在用于绑定class和style时,表达式结果可以是字符串.数组.对象. 一.绑定HTMLClass ① 对象语法 <div class="static& ...

  9. ORACLE存储过程定时器例子(存储过程变量赋值)

    CREATE OR REPLACE PROCEDURE SP_DSSJTS_XMRSLOG as str1 ); str2 ); str3 ); begin select 'xmrslog_'||ex ...

  10. verilog reg 初值问题

    虽然没有写初值 但是硬件电路肯定有逻辑电平的如果是用fpga实现的 缺省值为全0 也可以在信号声明时指定初始值如果是asic实现 初始值是随机的(但也是某个电平) 声明时指定初值会被忽略 rtl仿真时 ...