// OnStateEnter is called before OnStateEnter is called on any state inside this state machine
 //override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
 //
 //}
 // OnStateUpdate is called before OnStateUpdate is called on any state inside this state machine
 //override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
 //
 //}
 // OnStateExit is called before OnStateExit is called on any state inside this state machine
 public override void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     animator.ResetTrigger("prep");
     animator.ResetTrigger("draw");
     animator.ResetTrigger("vote");
     animator.ResetTrigger("result");
 }
 public override void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     animator.ResetTrigger ("Attack1");
     animator.ResetTrigger ("Attack2");
     animator.ResetTrigger ("Attack3");
     animator.ResetTrigger ("ChargedAttack");
     animator.SetBool ("HeavyCombo", false);
 }
 // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
 //override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
 //
 //}
 // OnStateExit is called when a transition ends and the state machine finishes evaluating this state
 public override void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     animator.GetComponent<Character>().Attack = false;
     if (stateInfo.IsTag("attack")) {
         animator.GetComponent<Character>().MeleeAttack();
     }
     animator.ResetTrigger("attack");
     animator.ResetTrigger("throw");
 }
 // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
 //override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
 //
 //}
 // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
 public override void OnStateUpdate(Animator animator, AnimatorStateInfo stateinfo, int layerindex)
 {
     if (Player.Instance.OnGround) {
         animator.SetBool("land", false);
         animator.ResetTrigger("jump");
     }
 }
Example #5
0
	//public static bool fade = false;
	void Start () {
		
		anim = GetComponent<Animator>();
		spr = GetComponent<SpriteRenderer>();
		anim.ResetTrigger("boltFade");
		bolt = false;
		//		spr.color = Color.red;
		//		Debug.Log(spr.color);
		//gameObject.GetComponent<Rigidbody2D>().simulated = false;
		
		
	}
    // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
    public override void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        var minion = animator.gameObject.GetComponent<Minion>();
        minion.navMeshAgent.SetDestination(minion.gatheringFlag.transform.position);
        minion.navMeshAgent.Resume();

        Minion.TargetType targetType = minion.UpdateTarget();
        if (targetType == Minion.TargetType.Minion)
        {
            animator.SetTrigger("TargetMinion");
            animator.ResetTrigger("TargetConstruction");
            animator.ResetTrigger("NoTarget");
        }
        else if (targetType == Minion.TargetType.Construction)
        {
            animator.SetTrigger("TargetConstruction");
            animator.ResetTrigger("TargetMinion");
            animator.ResetTrigger("NoTarget");
        }
        else
        {
            animator.SetTrigger("NoTarget");
            animator.ResetTrigger("TargetConstruction");
            animator.ResetTrigger("TargetMinion");
        }

        animator.SetBool("Arrived", minion.HasArrived());
    }
    // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
    public override void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        var minion = animator.gameObject.GetComponent<Minion>();

        minion.ChaseEnemy();
        attackTimer += Time.deltaTime;
        if(attackTimer >= attackInterval)
        {
            attackTimer -= attackInterval;
            minion.AttackEnemy();
        }

        Vector3 currFlagPos = flag.transform.position;

        if ((enterFlagPos - currFlagPos).sqrMagnitude >
        flag.smallMoveRange *
        flag.smallMoveRange)
            animator.SetBool("FlagMove", true);
        else animator.SetBool("FlagMove", false);

        //animator.SetBool("FlagMove", (enterFlagPos - currFlagPos).sqrMagnitude >
        //flag.smallMoveRange *
        //flag.smallMoveRange);

        Minion.TargetType targetType = minion.UpdateTarget();
        if (targetType == Minion.TargetType.Minion)
        {
            animator.SetTrigger("TargetMinion");
            animator.ResetTrigger("TargetConstruction");
            animator.ResetTrigger("NoTarget");
        }
        else if (targetType == Minion.TargetType.Construction)
        {
            animator.SetTrigger("TargetConstruction");
            animator.ResetTrigger("TargetMinion");
            animator.ResetTrigger("NoTarget");
        }
        else
        {
            animator.SetTrigger("NoTarget");
            animator.ResetTrigger("TargetConstruction");
            animator.ResetTrigger("TargetMinion");
        }
    }
Example #8
0
    private static void CarsContainerCheck(MoleculeContainer target, Animator animator, MoleculeCar[] cars)
    {
        foreach (var car in cars)
        {
            if (car.State == MoleculeCar.CarState.Waiting)
            {
                var carCargos = car.gameObject.GetComponentsInChildren<MoleculeCarCargo>();

                foreach (var cargo in carCargos)
                {
                    if (!cargo.IsLoaded && cargo.Formula == target.ContainerFormula && target.CollectCount > 5 && !target.IsAnimated)
                    {
                        /*
                        var go = (GameObject)Instantiate(ContainerPrefab, Vector3.zero, Quaternion.identity);
                        go.transform.parent = cargo.gameObject.transform;
                        go.transform.position = cargo.gameObject.transform.position;
                        go.transform.localPosition = Vector3.zero;
                        go.transform.localScale = Vector3.one * 0.001f;
                        */
                        target.IsAnimated = true;

                        target.gameObject.transform.parent = null;
                        var throwTo = target.gameObject.AddComponent<ThrowBehavior>();
                        throwTo.Projectile = target.gameObject.transform;
                        throwTo.Target = cargo.gameObject.transform;
                        throwTo.firingAngle = 45f;
                        var currentCar = car;
                        var currentCargo = cargo;
                        throwTo.AfterThrowAction = new Action(() =>
                        {
                            target.transform.parent = currentCargo.transform;
                            target.transform.position = currentCargo.gameObject.transform.position;
                            target.transform.localPosition = Vector3.zero;
                            target.transform.localScale = Vector3.one * 0.001f;
                            // target.Get(10);
                            currentCargo.IsLoaded = true;
                            if (!target.CanGet(1))
                            {
                                if (animator != null)
                                    animator.ResetTrigger(enoughsourcestrigger);
                            }

                            var stopPoint = GameObject.Find("StopPoint" + currentCar.Index);
                            var coin = stopPoint.GetComponentInChildren<MoleculeCoin>();
                            coin.BornCoin();
                        });
                    }
                }

            }
        }
    }
	// OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
	//override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
	//
	//}

	// OnStateExit is called when a transition ends and the state machine finishes evaluating this state
	override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
        animator.GetComponent<Character>().Attack = false;
        animator.ResetTrigger("attack");
        animator.ResetTrigger("throw");
    }
Example #10
0
    // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
    //override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
    //
    //}

    // OnStateExit is called when a transition ends and the state machine finishes evaluating this state
    override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        Player.Instance.Attack = false;
        animator.ResetTrigger("uppercut");
        animator.ResetTrigger("throw");
    }
Example #11
0
 // Use this for initialization
 void Start()
 {
     transform.position = new Vector3(0, GlobalVariables.playerDefHeight, 0);
     anim = GetComponent<Animator>();
     anim.ResetTrigger("TriggerHurt");
 }
 // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
 //override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
 //
 //}
 // OnStateExit is called when a transition ends and the state machine finishes evaluating this state
 public override void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     Player.Instance.Jump = false;
     animator.ResetTrigger("jump");
 }
	void Start () {
		anim = GetComponent<Animator>();
		anim.SetTrigger("instructionOpen");
		anim.ResetTrigger("instructionClose");
	}
Example #14
0
 public override void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     base.OnStateExit(animator, stateInfo, layerIndex);
     animator.ResetTrigger(exit);
 }
	// OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
	//override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
	//
	//}

	// OnStateExit is called when a transition ends and the state machine finishes evaluating this state
	override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
        Player.Instance.Slide = false;
        animator.ResetTrigger("slide");
	}
Example #16
0
    // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
    //override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
    //
    //}

    // OnStateExit is called when a transition ends and the state machine finishes evaluating this state
    override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        Brawler.Instance.Attack = false;
        animator.ResetTrigger("attack");
        
    }
Example #17
0
 // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
 public override void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     animator.ResetTrigger("atacarmele");
 }