示例#1
0
    protected override void Update()
    {
        base.Update();

        CheckChangeRobot();

        CheckMove();

        if (currentRobot.hasGun)
        {
            CheckAttack();
        }

        CheckExtra();

        if (zRotate)
        {
            SetRotation();
        }

        if (animationRenderer.GetBool(currentRobot.GetHasGunValueName()) != currentRobot.hasGun)
        {
            animationRenderer.SetBool(currentRobot.GetHasGunValueName(), currentRobot.hasGun);
            animationRenderer.SetTrigger(currentRobot.GetGunTriggerName());
        }
    }
示例#2
0
    void TriggerChangeRobot(int robotIDfrom, int robotIDto)
    {
        /*
         * Determine what animation we must to use
         * All animations collected by order, which depends on robotIDfrom
         * Animations for certain robot stay in robotID * 2 index and +1 (because all robots has 2 animations of transform)
         *
         * This formula help to find index in this order
         */
        int from = robotIDfrom, to = robotIDto, animationNumber;

        if (robotIDfrom < robotIDto)
        {
            to--;
        }

        animationNumber = from * 2 + to;
        if (animationRenderer.gameObject.activeSelf)
        {
            animationRenderer.SetInteger("RobotChangeAnimationID", animationNumber);
            animationRenderer.SetTrigger("ChangeRobotTrigger");
        }
    }