예제 #1
0
    IEnumerator BornAlienCoroutine(Clickable clickable)
    {
        while (currentLiveState.Equals(AlienLiveState.Born))
        {
            while (pauseInCupol || pauseInBlackHole)
            {
                yield return(null);
            }

            bornTime += Time.deltaTime;

            float currentScale = bornTime / GameplayConstants.AlienBornTime;

            fChild.transform.localScale = new Vector3(currentScale, currentScale, currentScale);



            if (bornTime > GameplayConstants.AlienBornTime)
            {
                bornTime = GameplayConstants.AlienBornTime;

                fChild.transform.localScale = new Vector3(1, 1, 1);

                currentLiveState = AlienLiveState.Alive;

                clickable.AlienWasBorning();
                break;
            }

            yield return(null);
        }

        //  childAnim.GetComponent<Image>().color = startColor;


        library.aliens.GetComponent <AlienController>().AddAlien(this);

        // SetLastTarget(clickable);
        //  finalTarget = clickable;
    }
예제 #2
0
    void Update()
    {
        GetPositionInClickable();

        if (!pauseInCupol && !pauseInBlackHole)
        {
            if (liveTime == 0)
            {
                currentLiveState = AlienLiveState.Die;
                return;
            }

            if (landWasChanged && currentMovementState != AlienMovementState.Charged && currentMovementState != AlienMovementState.Expulsion && currentMovementState != AlienMovementState.Jump)
            {
                landWasChanged = false;
                //UpdateIgnoreWall();
                FindFountain();
            }

            if (currentLiveState.Equals(AlienLiveState.Alive))
            {
                liveTime -= Time.deltaTime;
            }
            liveTime = Mathf.Max(liveTime, 0);

            if (currentMovementState == AlienMovementState.MoveToPoint && IsVeryHungry() && currentClickable.IsFountain())
            {
                SetMovementState(AlienMovementState.Charged);
                currentFountainTarget = null;
                StopAllCoroutines();
            }

            /*
             * if (AlienInWall() && !currentMovementState.Equals(AlienMovementState.Jump) && !currentLiveState.Equals(AlienLiveState.Born))
             * {
             *  if (currentMovementState.Equals(AlienMovementState.Expulsion))
             *  {
             *      if (currentClickable != null && currentClickable.IsWall() && currentClickableExpulsion != currentClickable)
             *      {
             *          currentLiveState = AlienLiveState.Die;
             *          return;
             *      }
             *  }
             *  else
             *  {
             *      StopAllCoroutines();
             *      StartCoroutine(ExpulsionAlien());
             *  }
             * }*/


            if (currentClickable != null && currentClickable.IsFountain() && currentMovementState.Equals(AlienMovementState.Charged))
            {
                liveTime += Time.deltaTime * GameplayConstants.AlienCoefRateFountain;
                liveTime  = Mathf.Min(liveTime, GameplayConstants.AlienFullLiveTime);
                currentClickable.UseFountain();
            }


            if (currentMovementState.Equals(AlienMovementState.Charged) && (liveTime == GameplayConstants.AlienFullLiveTime || !currentClickable.FountainExist()))
            {
                SetMovementState(AlienMovementState.Free);
                currentFountainTarget = null;
            }
        }
    }