╮(╯▽╰)╭没办法,小妖精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. spring(AOP)静态代理

    姓名:黄于霞      班级:软件151 1.定义抽象主题接口,假设需实现一个计算的类Math.完成加.减.乘.除功能,如下所示: 2.主题类,算术类,实现抽象接口. 3.代理类 4.测试运行 5.总 ...

  2. react-native-router-flux

    这是一个路由,可以用来做Android底部的导航栏,学Android的都知道,如果用原生的代码来 做导航栏,会很复杂,关系到很多复杂的知识. 接下来我就简单的说明一下如何插入和使用吧: 1.你要先依赖 ...

  3. emacs技巧

    Table of Contents "ctrl space"设置mark 同时在选中的各行行首添加相同内容 寄存器 跳转到某行 删除光标所在的空格和TAB或空白行 把TAB全部转换 ...

  4. 记录一次配置golang服务器端口

    之前配置程序监听端口,地址都写成IP+:Port的格式,然而一直调试不同,也找不出问题. 后来,参考博客https://blog.csdn.net/yoie01/article/details/214 ...

  5. BigDecimal类的用法

    (一)BigDecimal类的常用的几个构造方法 BigDecimal(int):将int表示形式转换为BigDecimal对象 BigDecimal(String):将字符串表示形式转换为BigDe ...

  6. JavaWeb基础-Jsp的请求与响应

    JSP请求和相应 HTTP头信息 当浏览器请求一个网页时,它会向网络服务器发送一系列不能被直接读取的信息,因为这些信息是作为HTTP信息头的一部分来传送的. HttpServletRequest类 r ...

  7. JSP学习(1)---JSP基本原理

    一.JSP的本质 其本质是Servlet,web应用中的每个jsp页面都会由servlet容器生成对应的servlet. 在tomcat中,jsp生成的servlet在work文件夹下: 原jsp文件 ...

  8. jQuery 的自定义事件

    jQuery  中,想要自动触发自定义事件,必须满足2个条件: 1.事件必须是通过on 来绑定的. 2.事件必须是通过trigger / triggerHandler 来触发. 格式如下: $(fun ...

  9. Windows Server 2012系统上安装.net framework3.5教程

    1.先下载WIN2012R2安装NET3.5的专用数据源 https://pan.baidu.com/s/1bqiUTyR 提取码h09k 并解压,比如解压到桌面,解压后的路径为C:\Users\Ad ...

  10. 【转】Android-Input 触控笔

    https://source.android.com/devices/accessories/stylus 触控笔 Android 6.0 及更高版本支持蓝牙 (BT).蓝牙低功耗 (BTLE) 或 ...