private void CallExecuteAbility() { if (ability != null) { //Vector2 aimDirection = newAiming.GetComponent<AimingDirection>().AimDirection; //ability.ExecuteAbility(-aimDirection); animatorController.CanDoAbility(); Invoke("AbilityAfterAnimation", 1f); iplayer.AbilityUsed(ability.abilityCoolDown); } else { ability = GetComponent <AbilityAbstract>(); if (ability != null) { //Vector2 aimDirection = newAiming.GetComponent<AimingDirection>().AimDirection; //ability.ExecuteAbility(-aimDirection); animatorController.CanDoAbility(); Invoke("AbilityAfterAnimation", 1f); iplayer.AbilityUsed(ability.abilityCoolDown); } else { Debug.LogError("No ability attached to the player"); return; } Debug.LogWarning("No ability attached to the player"); } }
private void Start() { if (!photonView.IsMine) { return; } canvas = GameObject.FindGameObjectWithTag("UI").gameObject; animatorController = GetComponent <AnimatorController>(); movementClass = GetComponent <MovementAbstract>(); iplayer = GetComponent <IPlayer>(); ability = GetComponent <AbilityAbstract>(); trapClass = GetComponent <TrapAbstract>(); weaponManager = GetComponent <WeaponManager>(); shopCanvas = GameObject.Find("Shop Canvas"); shopCanvas = shopCanvas.transform.GetChild(0).gameObject; saberPrefab = Resources.Load <GameObject>("Melee Weapon Saber"); //saberPrefab = Resources.Load<GameObject>("Objective"); macePrefab = Resources.Load <GameObject>("Melee Weapon Mace"); knifePrefab = Resources.Load <GameObject>("Melee Weapon Knife"); clubPrefab = Resources.Load <GameObject>("Melee Weapon Club"); pistolPrefab = Resources.Load <GameObject>("Gun Vintage Pistol"); //Set the action button listener uiBtns = GameObject.FindGameObjectWithTag("UI").GetComponent <UIBtns>(); AddDelegates(); }
private void CallAbilityIsStarting() { if (ability != null) { ability.AbilityIsStarting(aimingPrefab); } else { ability = GetComponent <AbilityAbstract>(); if (ability != null) { ability.AbilityIsStarting(aimingPrefab); } else { Debug.LogError("No ability attached to the player"); return; } Debug.LogWarning("No ability attached to the player"); } }