Esempio n. 1
0
    public void setPlayerSpritePose(MGDirectionUtils.MGDirection poseDirection, ARROW_TYPE arrowType)
    {
        SpriteRenderer temp = playerSprite.GetComponent <SpriteRenderer>();

        /*if (arrowClassification == ARROW_TYPE.FRIEND)
         * {
         *  temp.sprite = playerSpriteSheet [listMark];
         * }*/
        //If arrow_type is class, it is randomized
        // GARRAH: What does friendMove indicate? What does this code do?
        //  If friendMove is true, our player moves according to key-press
        //  If friendMove is false, the player's movement is randomized
        if (arrowType == ARROW_TYPE.CLASS && friendMove == false)
        {
            int rand = Random.Range(0, 4);

            while (rand == ConvertDirectionToSpriteIndex(poseDirection))
            {
                rand = Random.Range(0, 4);
            }

            temp.sprite = playerSpriteSheet[rand];
        }
        else if (arrowType == ARROW_TYPE.FRIEND)
        {
            temp.sprite = playerSpriteSheet[ConvertDirectionToSpriteIndex(poseDirection)];
            friendMove  = true;
        }
    }
Esempio n. 2
0
    static public float DirectionToArrowAngle(MGDirectionUtils.MGDirection dir)
    {
        float ret = 0.0f;

        switch (dir)
        {
        case MGDirectionUtils.MGDirection.UP:
        {
            ret = 0.0f;
        } break;

        case MGDirectionUtils.MGDirection.DOWN:
        {
            ret = 180.0f;
        } break;

        case MGDirectionUtils.MGDirection.LEFT:
        {
            ret = 90.0f;
        } break;

        case MGDirectionUtils.MGDirection.RIGHT:
        {
            ret = 270.0f;
        } break;

        default:
        {
            Debug.LogError("Invalid value for 'dir' in ArrowTurnScript.ConvertDirectionToArrowAngle()");
        } break;
        }
        return(ret);
    }
Esempio n. 3
0
    public void setFriendPose(MGDirectionUtils.MGDirection poseDirection)
    {
        SpriteRenderer temp = friendSprite.GetComponent <SpriteRenderer>();

        int spriteIndex = ConvertDirectionToSpriteIndex(poseDirection);

        temp.sprite = friendSpriteSheet[spriteIndex];
    }
Esempio n. 4
0
    public void SetMainArrowDirection(MGDirectionUtils.MGDirection dir)
    {
        // TODO: refactor sprite manager to take MGArrowDirection, and refactor
        //  the following line to take "dir":

        //callSprScr.ClassChange (classArrNumPrev);

        this.GetSoundController().ResumePlay();
    }
Esempio n. 5
0
    public void setClassPose(MGDirectionUtils.MGDirection poseDirection)
    {
        SpriteRenderer temp;

        for (int i = 0; i < classSprite.Count; i++)
        {
            temp        = classSprite[i].GetComponent <SpriteRenderer>();
            temp.sprite = classSpriteSheet[ConvertDirectionToSpriteIndex(poseDirection)];
        }
    }
 public void ChangeCharacterPose(MGDirectionUtils.MGDirection poseDirection, ARROW_TYPE arrowType)
 {
     if (arrowType == ARROW_TYPE.FRIEND)
     {
         friendPosePrev = poseDirection;
         callSprScr.setFriendPose(friendPosePrev);
     }
     else if (arrowType == ARROW_TYPE.CLASS)
     {
         classPosePrev = poseDirection;
         callSprScr.setClassPose(classPosePrev);
     }
 }
Esempio n. 7
0
    public void TurnArrow(MGDirectionUtils.MGDirection direction)
    {
        if (arrowTag == ARROW_TYPE.CLASS)
        {
            ownRender.enabled = true;
        }
        else if (arrowTag == ARROW_TYPE.FRIEND && TwoDGameManScr.GetLevelName() == TwoDGameManager.LEVEL_2D_NAMES.STAGE_1)
        {
            if (TwoDGameManScr.IsFriendArrowEnabled() == true)
            {
                ownRender.enabled = true;
            }
        }

        // Determine the arrow's angle for the given direction
        float turnDegree = DirectionToArrowAngle(direction);

        transform.eulerAngles = new Vector3(transform.eulerAngles.x, transform.eulerAngles.y, turnDegree);
        //Sends the manager the current number, which will be used later, as well as the enum tag of the arrow.
        TwoDGameManScr.ChangeCharacterPose(direction, arrowTag);
        arrowDirection = direction;
    }
Esempio n. 8
0
 static public int ConvertDirectionToSpriteIndex(MGDirectionUtils.MGDirection dir)
 {
     return(MGDirectionUtils.IntFromDirection(dir));
 }
 // Sets Friend's pose
 public void setFriendPose(MGDirectionUtils.MGDirection poseDirection)
 {
     friendCurrPose = poseDirection;
     callSprScr.setFriendPose(poseDirection);
 }