小妖精的完美游戏教室——东方PROJECT,同人,th12灵梦A
╮(╯▽╰)╭没办法,小妖精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的更多相关文章
- 小妖精的完美游戏教室——东方project,同人,自机
//================================================================ //// Copyright (C)// All Rights R ...
- 小妖精的完美游戏教室——东方PROJECT,同人,墙
//================================================================//// Copyright (C) 东方同人社// All Rig ...
- 小妖精的完美游戏教室——东方PROJECT,同人,符卡系统
//================================================================//// Copyright (C) 东方同人社// All Rig ...
- 小妖精的完美游戏教室——东方PROJECT,同人,子机
//================================================================//// Copyright (C)// All Rights Re ...
- 小妖精的完美游戏教室——人工智能,A*算法,引言
今天也要直播魔法,求科学的! 欢迎来到小妖精Balous的完美游戏教室! 经过前两周的学习,相信米娜桑已经对状态机有所了解了呢~虽然状态机能够实现几乎所有的人工智能,但是,在实践中,你们有没有发现,自 ...
- 小妖精的完美游戏教室——人工智能,A*算法,启发因子篇
//================================================================//// Copyright (C) 2017 Team Saluk ...
- 小妖精的完美游戏教室——人工智能,A*算法,导航网络篇
//================================================================//// Copyright (C) 2017 Team Saluk ...
- 小妖精的完美游戏教室——人工智能,A*算法,结点篇
//================================================================//// Copyright (C) 2017 Team Saluk ...
- 小妖精的完美游戏教室——人工智能,A*算法,实现篇
//================================================================//// Copyright (C) 2017 Team Saluk ...
随机推荐
- element-ui的那些坑与总结
tags: 默认情况下,下划线是文本宽度 如果要加宽,则可以设置文本(label)的padding, 常规情况下,无法改label宽度,因为他是动态计算的 不过,可以通过自定义,把label拿出来,自 ...
- CodeForces - 1040B Shashlik Cooking(水题)
题目: B. Shashlik Cooking time limit per test 1 second memory limit per test 512 megabytes input stand ...
- 活代码LINQ——09
一.代码 ' Fig. 9.7: LINQWithListCollection.vb ' LINQ to Objects using a List(Of String). Module LINQWit ...
- java_jsp和servlet中乱码问题
- SSM连接数据库自动生成问题
错误的结果为: 程序里面写的sql语句放在数据库里面去查询能查询到数据,但是程序里面查询时候,返回的结果为null 记录一下 我出现的原因是: 数据库的字段 account_id accoun ...
- 自己设置 WiFi
不想安装免费WiFi? 简单,一行命令搞定 首先,打开你的 cmd 面板, 然后敲出命令: netsh wlan set hostednetwork mode=allow ssid=wifi key= ...
- LeakCanary 来检查 Android 内存泄漏
LeakCanary 来检查 Android 内存泄漏
- 记一次msyql导入导致的问题
公司有个项目要导入150M大小的sql文件,但是导入时报错,去网上找答案,很多人说是因为保留字什么什么的,所以就按照sql文件里面的mysql版本又去下载了一份mysql5.6安装好,但是登陆不了,又 ...
- css中width:auto和width:100%的区别是什么
width的值一般是这样设置的: 1,width:50px://宽度设为50px 2,width:50%://宽度设为父类宽度的50% 3,还有一个值是auto(默认值),宽度是自动的,随着内容的增加 ...
- Java容器解析系列(9) PrioriyQueue详解
PriorityQueue:优先级队列; 在介绍该类之前,我们需要先了解一种数据结构--堆,在有些书上也直接称之为优先队列: 堆(Heap)是是具有下列性质的完全二叉树:每个结点的值都 >= 其 ...