Exemple #1
0
    public Queue <Clickable> GetWayToClickable(Clickable currentClickable, Clickable finalClickable)
    {
        Vector2 currentPosInMatrix = Lee.GetPosInMatrix(currentClickable.num, currentClickable.GetFloor());
        Vector2 finalPosInMatrix   = Lee.GetPosInMatrix(finalClickable.num, finalClickable.GetFloor());

        Vector2[] vectArr = Lee.GetRecoveryWay((int)currentPosInMatrix.x, (int)currentPosInMatrix.y, (int)finalPosInMatrix.x, (int)finalPosInMatrix.y);

        Queue <Clickable> tempQueue = new Queue <Clickable>();

        for (int i = 0; i < vectArr.Length; i++)
        {
            // Debug.Log(vectArr[i]);
            if (i == vectArr.Length - 1)
            {
                tempQueue.Enqueue(GetClickableByPosInMatrix(vectArr[i]));
                break;
            }

            if (IsJumping(GetClickableByPosInMatrix(vectArr[i])) && GetClickableByPosInMatrix(vectArr[i + 1]) == null)
            {
                tempQueue.Enqueue(GetClickableByPosInMatrix(vectArr[i]));
                i += 2;
            }
        }
        //Debug.Log(" ");

        return(tempQueue);
    }
Exemple #2
0
    IEnumerator JumpCoroutine(JumpDirection direction, Clickable clickable)
    {
        SetMovementState(AlienMovementState.Jump, direction);
        readyToJump = false;

        library.audioController.Jump();

        switch (direction)
        {
        case JumpDirection.RightUp: yield return(childAnim.GetComponent <Animator>().PlayAnimation(1)); break;

        case JumpDirection.LeftUp: yield return(childAnim.GetComponent <Animator>().PlayAnimation(2)); break;

        case JumpDirection.RightDown: yield return(childAnim.GetComponent <Animator>().PlayAnimation(3)); break;

        case JumpDirection.LeftDown: yield return(childAnim.GetComponent <Animator>().PlayAnimation(4)); break;
        }

        transform.position = childAnim.transform.position;
        transform.GetComponent <RectTransform>().anchoredPosition = new Vector2(transform.GetComponent <RectTransform>().anchoredPosition.x, transform.GetComponent <RectTransform>().anchoredPosition.y - fChild.GetComponent <RectTransform>().anchoredPosition.y);

        //      SetLastTarget(clickable);

        currentFloor = clickable.GetFloor();

        MoveToTarget();
    }
Exemple #3
0
    int GetLenToPos(Clickable firstClickable, Clickable secondClickable)
    {
        Vector2 aVector = Lee.GetPosInMatrix(firstClickable.num, firstClickable.GetFloor());
        Vector2 bVector = Lee.GetPosInMatrix(secondClickable.num, secondClickable.GetFloor());

        return(Lee.GetLength((int)aVector.x, (int)aVector.y, (int)bVector.x, (int)bVector.y));
    }
Exemple #4
0
    public void StartBorn(Clickable clickable)
    {
        currentClickable = clickable;
        currentFloor     = clickable.GetFloor();
        StartCoroutine(BornAlienCoroutine(clickable));


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

        //     currentLiveState = AlienLiveState.Alive;

        //  clickable.AlienWasBorning();
    }
Exemple #5
0
    public List <Clickable> GetClickableInArea(Clickable currentClickable, int min, int length)
    {
        Vector2 currentPosInMatrix = Lee.GetPosInMatrix(currentClickable.num, currentClickable.GetFloor());

        Vector2[] vectArr = Lee.GetPositionInArea((int)currentPosInMatrix.x, (int)currentPosInMatrix.y, min, length);

        List <Clickable> listClickable = new List <Clickable>();

        foreach (Vector2 vect in vectArr)
        {
            Clickable clickable = GetClickableByPosInMatrix(vect);

            if (clickable != null)
            {
                listClickable.Add(clickable);
            }
        }

        return(listClickable);
    }