コード例 #1
0
    private void Update()
    {
        base.Update();

        if (startScorpionAttack)
        {
            GalagaHelper.isScorpionAttackOn = true;
            form1.GetComponent <EnemySpawner>().CreateEnemy4Trio(this.transform, this.transform.parent.transform);
            GetComponent <Renderer>().enabled = false;
            gameObject.transform.parent       = null;
            SimplePool.Despawn(gameObject);
            GalagaHelper.StartScorpionPaths();
            startScorpionAttack = false;
        }

        // if enemy has made it to last point then reappear from top
        // of screen.
        if (_finishedPath)
        {
            //this.isEnemyFiring = false;
            CreateIncomingPath();

            if (_isOnPath)
            {
                iTween.PutOnPath(gameObject, _waypoints.ToArray(), _pathPercentage);
                _pathPercentage += Time.deltaTime * returnPathSpeed / 10;
                //Debug.Log("path Percent: " + _pathPercentage);
                if (_pathPercentage > 1)
                {
                    _isOnPath          = false;
                    _finishedPath      = false;
                    _pathPercentage    = 0;
                    transform.rotation = _originalRotation;
                    main.isEnemy1Done  = true;
                    isNotInFormation   = false;
                }
            }
        }
    }