//called with StartGameState GameEvent public void StartGame() { playerUIAnimatorCtrls = GetComponent <PlayerUIAnimatorCtrls>(); elementals.Clear(); currentElement = SO_Elemental.elementType.NEUTRAL; currentElemental = null; }
public void TakeDamage(int _dam, int _kBForce, SO_Elemental.elementType damElement, Vector3 _dir) //takes the damage, knockback force, element, and force direction { SO_Elemental _so_Elemental = elementManager.currentElemental.GetComponent <ElementalData>().so_Elemental; //if the damager's element is not NEUTRAL if ((int)damElement != 0) { //if the damager's element is weak against the damager's element, apply double damage if (_so_Elemental.elementStrengthOne == damElement || _so_Elemental.elementStrengthTwo == damElement) { currentHealth += _dam / 2; } //if the damager's element is strong against the damager's element, apply double damage if (_so_Elemental.elementWeakness == damElement) { currentHealth += _dam * 2; } } else { currentHealth += _dam; } //if there are no elements just apply damage normally print(currentHealth); //_dir = calculateForce (_dir, currentHealth * .01f , _kBForce *.05f); //calculates the force to be applied to the object _dir = calculateForce(_dir, currentHealth, .01f) + calculateForce(_dir, _kBForce, .05f); //trying different ways of calculating the force if (isMoveable) { //determines if the object can be moved if (usesNav) { // StartCoroutine(ApplyForceNav(_dir)); NR.Push(_dir); } else { if (usesCC) { //if it has a character controller StartCoroutine(ApplyForceCC(_dir)); //use the character controller mehtod of adding force } else { AddForce(_dir, RB); } //else, ie if it has a RB, add force using the RB method } } }
void SwapElements() { GameObject _temp = elementals [1]; elementals [1] = elementals [0]; elementals [0] = _temp; currentElemental = _temp; elementals [1].transform.position = elementSlotOne.position; elementals [1].transform.parent = elementSlotOne; elementals [0].transform.position = elementSlotTwo.position; elementals [0].transform.parent = elementSlotTwo; currentElement = elementals[0].GetComponent <ElementalData>().so_Elemental.type; playerUIAnimatorCtrls.SwapElement(); }