コード例 #1
0
 // Update is called once per frame
 void Update()
 {
     if (StaticParameter.ComparePosition(transform, HumanManager.Nature.Human) > 80.0f)
     {
         return;
     }
     if (_rotate_Bool)
     {
         transform.Rotate(0, -2, 0, Space.World);
     }
 }
コード例 #2
0
ファイル: Missile.cs プロジェクト: 1102736067/SushiNinja
    IEnumerator StartToMove()
    {
        yield return(new WaitUntil(() =>
        {
            if (MyKeys.Pause_Game)
            {
                return false;
            }
            if (IsHighSpeed())
            {
                return transform.position.y - (Camera.main.transform.position.y - HumanManager.Nature.Difference_Y) < 22.5;
            }
            else
            {
                return transform.position.y - (Camera.main.transform.position.y - HumanManager.Nature.Difference_Y) < 15;
            }
        }));

        //显示导弹提示线
        MyPool.Instance.Spawn(StaticParameter.s_Prefab_Line, transform.position, _line_Rotation);

        yield return(new WaitUntil(() =>
        {
            if (MyKeys.Pause_Game)
            {
                return false;
            }
            if (IsHighSpeed())
            {
                _distance -= HumanManager.Nature.Run_Speed * 1.5f;
            }
            else
            {
                _distance -= HumanManager.Nature.Run_Speed;
            }

            return _distance <= 0;
        }));

        //开启火焰特效
        Transform fire = MyPool.Instance.Spawn(StaticParameter.s_Prefab_Fire);

        _fire_Effect  = fire;
        fire.position = transform.position;
        fire.rotation = transform.rotation;

        yield return(new WaitUntil(() =>
        {
            if (MyKeys.Pause_Game)
            {
                return false;
            }

            transform.Translate(0, -0.15f, 0, Space.World);
            fire.position = transform.position;
            return StaticParameter.ComparePosition(this.transform, HumanManager.Nature.Human) < -50;
        }));

        MyPool.Instance.Despawn(fire);
        //到达距离,销毁导弹,在无尽模式下回收对象
        //Destroy(gameObject);
        StaticParameter.DestroyOrDespawn(transform);
    }