// Update is called once per frame void Update() { if (((PlayerController)controller).riding) { return; } if (Attacking && (InputManager.GetButtonDown(Control.Knife, InputAxis.Slash) || InputManager.GetButtonDown(Control.Skewer, InputAxis.Skewer))) { StopAllCoroutines(); r.color = Color.white; currLevel = 0; inv.CanSwap = true; chargedAttack = false; Attacking = false; CanBeCanceled = false; return; } //conditions to throw: Must either have ingredients OR a cooked recipe if (!Attacking && InputManager.GetButtonDown(control, axis) && (!inv.ActiveSkewerEmpty() || inv.ActiveSkewerCooked())) { chargedAttack = true; center = r.bounds.center; //Get the first attack from dependecies that is attacking, else null AttackBase activeAttack = dependecies.FirstOrDefault((at) => at.Attacking); if (activeAttack == null) { StartCoroutine(Charge()); } else if (activeAttack.CanBeCanceled) { activeAttack.Cancel(); StartCoroutine(Charge()); } } if (InputManager.GetButtonUp(control, axis) && Attacking) { StopAllCoroutines(); effectRecipeData = inv.GetActiveEffect(); flavorCountDictionary = new Dictionary <RecipeData.Flavors, int>(inv.GetActiveFlavorDictionary()); ingredientArray = inv.GetActiveSkewer().ToArray(); r.color = Color.white; currLevel = 0; Attack(); inv.ClearActiveRecipe(); inv.ClearActiveSkewer(); inv.CanSwap = true; Attacking = false; chargedAttack = false; } }
// Update is called once per frame void Update() { if (InputManager.GetButtonDown(control, axis)) { //Get the first attack from dependecies that is attacking, else null AttackBase activeAttack = GetActiveAttack(); if (activeAttack == null) { Attack(); } else if (activeAttack.CanBeCanceled) { activeAttack.Cancel(); Attack(); } } }
// Update is called once per frame void LateUpdate() { if (InputManager.GetButtonDown(control, axis)) { //Get the first attack from dependecies that is attacking, else null AttackBase activeAttack = GetActiveAttack(); if (activeAttack == null) { RecalculatePosition(); Attack(); } else if (activeAttack.CanBeCanceled && activeAttack.CancelPriority <= CancelPriority) { //Debug.Log("Cancelling into" + this.ToString()); activeAttack.Cancel(); RecalculatePosition(); Attack(); } } }