Ejemplo n.º 1
0
    //private Queue recallList = new Queue();


    void Awake()
    {
        transformRenderer = GetComponent <Transform>();

        cont          = GetComponent <PlayerPlatformerController>();
        animator      = GetComponent <Animator>();
        recallState   = RecallState.Ready;
        recallOutline = GameObject.Find("RecallOutline");
        recallOutline.GetComponent <SpriteRenderer>().enabled = false; // turn off the outline
    }
Ejemplo n.º 2
0
    protected override void RecallAbilityCheck()
    {
        cont           = GetComponent <PlayerPlatformerController>();
        spriteRenderer = GetComponent <SpriteRenderer>();
        var isRecallKeyDown = Input.GetKeyDown(KeyCode.X);         // this was inside the switch

        switch (recallState)
        {
        case RecallState.Ready:
            if (isRecallKeyDown)
            {
                print("Recall prepped");

                prepPosition = transformRenderer.localPosition;
                //recallOutline.GetComponent<Transform> () = transformRenderer;
                recallState = RecallState.Prepped;
                recallOutline.GetComponent <Transform> ().localPosition = prepPosition;
                recallOutline.GetComponent <SpriteRenderer>().enabled   = true;
            }
            break;

        case RecallState.Prepped:
            if (isRecallKeyDown)
            {
                print("Recalling!");
                transformRenderer.localPosition = prepPosition;
                recallCooldownTimer             = recallCooldown;
                recallState = RecallState.Cooldown;
                recallOutline.GetComponent <SpriteRenderer>().enabled = false;
            }
            break;

        case RecallState.Cooldown:

            recallCooldownTimer -= Time.deltaTime;
            if (recallCooldownTimer <= 0)
            {
                recallCooldownTimer = 0;
                recallState         = RecallState.Ready;
                //recallOutline.GetComponent<SpriteRenderer>().enabled = true;
            }
            break;
        }
    }