Пример #1
0
    bool parseAction(IAction action, Collider collider = null, bool trigger = false)
    {
        if (action is ActionTriggerRun)
        {
            ActionTriggerRun runActionTrigger = (ActionTriggerRun)action;
            return(this.setRunDirection(runActionTrigger, runActionTrigger.getDirection()));
        }
        else if (action is ActionRun)
        {
            ActionRun actionRun = action as ActionRun;
            if (trigger)
            {
                return(this.setRunDirection(actionRun, actionRun.GetTriggerDirection()));
            }
            if (this.wannaBeDirection != this.direction)
            {
                return(this.setRunDirection(actionRun, this.wannaBeDirection));
            }
        }
        else if (action is ActionSafetyNetForRun)
        {
            if (this.wannaBeDirection != this.direction)
            {
                return(((ActionSafetyNetForRun)action).EarlyMove(this.wannaBeDirection));
            }
        }
        else if (action is ActionTranslate)
        {
            ActionTranslate translateAction = (ActionTranslate)action;
            this.transform.Translate(translateAction.getTranslateVector(), Space.World);
            return(true);
        }

        else if (action is ActionDeath)
        {
            this.die(((ActionDeath)action).getType());
        }

        return(false);
    }
Пример #2
0
    bool parseAction(IAction action, Collider collider = null, bool trigger = false)
    {
        if (action is ActionPickUp)
        {
            ActionPickUp pickUpAction = (ActionPickUp)action;
            pickUpAction.executePickUp(this);
            return(true);
        }
        else if (action is ActionTriggerRun)
        {
            ActionTriggerRun runActionTrigger = (ActionTriggerRun)action;
            return(this.setRunDirection(runActionTrigger, runActionTrigger.getDirection()));
        }
        else if (action is ActionRun)
        {
            ActionRun actionRun = action as ActionRun;
            if (trigger)
            {
                return(this.setRunDirection(actionRun, actionRun.GetTriggerDirection()));
            }
            if (this.wannaBeDirection != this.direction)
            {
                return(this.setRunDirection(actionRun, this.wannaBeDirection));
            }
        }
        else if (action is ActionSafetyNetForRun)
        {
            if (this.wannaBeDirection != this.direction)
            {
                return(((ActionSafetyNetForRun)action).EarlyMove(this.wannaBeDirection));
            }
        }
        else if (action is ActionTranslate)
        {
            ActionTranslate translateAction = (ActionTranslate)action;
            this.transform.Translate(translateAction.getTranslateVector(), Space.World);
            return(true);
        }
        else if (action is ActionSlide)
        {
            ActionSlide slideAction = action as ActionSlide;
            if (this.boarding && slideAction.slideStart)
            {
                if (this.inAir)
                {
                    this.offsetAnimator.SetBool("Slide", true);
                }
                else
                {
                    this.boarding = false;
                    //this.SetupBoarding();
                }
            }
            else
            {
                this.offsetAnimator.SetBool("Slide", false);
                this.offsetAnimator.SetTrigger("StartHover");
            }
        }
        else if (action is ActionJump)
        {
            ActionJump jumpAction = action as ActionJump;
            if (this.boarding && this.jumping == -1f)
            {
                this.jumping            = 0f;
                this.startJumpingVector = this.transform.position;
                this.endJumpingVector   = jumpAction.GetTargetPosition();
            }
        }
        else if (action is ActionDeath)
        {
            this.die(((ActionDeath)action).getType());
        }

        return(false);
    }