public override void InitState()
    {
        base.InitState ();

        if (BattleManager.singleton.selectedAction as MoveAction != null) {
            BattleManager.singleton.selectedAction.checkDistance = BattleManager.singleton.selectedAgent.moveSteps;
        }

        animControlRef = battleManRef.selectedAgent.GetComponent<AgentAnimController>();
        modelRotControl = battleManRef.selectedAgent.GetComponent<ModelRotationController>();

        battleManRef.selectedAction.agent = battleManRef.selectedAgent;

        animControlRef.TriggerAnim(battleManRef.selectedAction.animInfo);
        //modelRotControl.desiredPos = battleManRef.targetTile.transform.position;
    }
Example #2
0
    protected override void Awake()
    {
        _motor = GetComponent<TileMotor>();
        _modelRotControl = GetComponent<ModelRotationController>();
        _stats = GetComponent<BaseStats>();

        //Ensure model we have is synchronized
        if (_modelRotControl.modelTf == null && model != null) {//assign to rotation controller
            _modelRotControl.modelTf = model.transform;
        }
        else if (model == null && _modelRotControl.modelTf != null) {//get model from rotation controller
            model = _modelRotControl.gameObject;
        }
        RefreshTurn();
        base.Awake();
    }
 // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
 public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     modelRotControl = animator.transform.root.GetComponent<ModelRotationController>();
 }