Exemple #1
0
 override protected void OnButtonDown(Controller.Command command)
 {
     if (command == Controller.Command.ATTACK)
     {
         if (isAttacking)
         {
             return;
         }
         isAttacking     = true;
         speedMultiplier = 0f;
         float stareTime = attackCharge;
         GetComponentInChildren <SpriteRenderer>().DOColor(Color.blue, stareTime);
         GetComponent <Animator>().enabled = false;
         pounceTimer = TimeControl.StartTimer(stareTime, () => {
             speedMultiplier = attackSpeedMultiplier;
             GetComponent <Attack>().isAttacking = true;
             audio.clip = attackSFX;
             audio.Play();
             pounceTimer = TimeControl.StartTimer(attackTime, () =>
             {
                 speedMultiplier = defaultSpeedMultiplier;
                 GetComponent <Attack>().isAttacking = false;
                 isAttacking = false;
                 GetComponent <Animator>().enabled = true;
                 GetComponentInChildren <SpriteRenderer>().color = Color.white;
             });
         });
     }
 }
Exemple #2
0
    public override bool StartAttack()
    {
        if (!base.StartAttack())
        {
            return(false);
        }

        //transform.DOLocalRotate(new Vector3(0f, 0f, -90f), attackTime).SetRelative().OnComplete(FinishAttack);
        TimeControl.StartTimer(attackTime, FinishAttack);
        return(true);
    }
Exemple #3
0
    void StartGathering()
    {
        titleText.SetText("A Natural Selection...\n\n\nLoading World");

        TimeControl.StartTimer(.1f, () =>
        {
            foodGathered = 0;
            timeLeft     = startingTime;
            onTimeTick.Invoke(timeLeft);
            onFoodGathered.Invoke(foodGathered, foodRequirement);
            player.GetComponent <Health>().RestoreHealth(999);
            MapManager.instance.GenerateMap(mapSize, 10);
        });
    }
Exemple #4
0
 void GenerateMenu(int numOptions)
 {
     for (int i = 0; i < numOptions; i++)
     {
         EvolutionMenuView menuItem = Instantiate(menuViewTemplate, this.transform);
         menuItem.transform.localPosition = new Vector3(-4f + (i * 2f), 0f, 1f);
         menuItem.transform.localScale    = new Vector3(.75f, .75f, 1f);
         Evolution evolution = new Evolution();
         evolution.GenerateEvolution();
         menuItem.evolution = evolution;
         menuItems.Add(menuItem);
     }
     TimeControl.StartTimer(.1f, () =>
                            UpdateSelection());
 }
Exemple #5
0
    void StartDash()
    {
        if (!stamina.ConsumeSP(20))
        {
            return;
        }

        speedMultiplier = dashSpeed;
        isDashing       = true;
        Instantiate(dashAnimTemplate, transform.position, Quaternion.identity);
        SoundController.PlaySFX(Util.RandomFromArray(dodgeSFXOptions));
        TimeControl.StartTimer(dashLength, () =>
        {
            speedMultiplier = defaultSpeedMultiplier;
            isDashing       = false;
        });
    }