// Use this for initialization void Start() { player = GameObject.FindWithTag("Player"); combatStats = player.GetComponent <PlayerCombatScript>(); textUI = gameObject.GetComponent <Text>(); textUI.text = ""; }
public override void Execute(Fighter fighterRef, PlayerCombatScript combatScript) { fighterRef.GetComponent<Animator>().SetTrigger(_jumpHash); Vector2 v = gameObject.GetComponent<Rigidbody2D>().velocity; v.y = _jumpSpeed; fighterRef.gameObject.GetComponent<Rigidbody2D>().velocity = v; }
private void OpenUpgradeMenuForWeapon(GameObject weapon) { PlayerCombatScript combatScript = player.GetComponent <PlayerCombatScript>(); inventoryPanel.SetActive(false); upgradePanel.GetComponentInChildren <WeaponShopRowHandler>().RefreshWeapon(weapon); Button lvlUpButton = upgradePanel.GetComponentInChildren <Button>(); lvlUpButton.onClick.RemoveAllListeners(); WeaponScript weaponScript = weapon.GetComponent <WeaponScript>(); lvlUpButton.onClick.AddListener(() => OpenBuyMenuForWeapon(weapon, "Level up " + weaponScript.weaponName + " for " + weaponScript.weaponPriceToLevelUp + " coins?", () => TriggerWeaponLevelUp(weapon, combatScript.Level, weaponScript.weaponPriceToLevelUp, lvlUpButton), weaponScript.weaponPriceToLevelUp)); if (weapon.GetComponent <WeaponScript>().weaponLevel >= combatScript.Level) { lvlUpButton.interactable = false; } else { lvlUpButton.interactable = true; } ReloadGems(weapon); upgradePanel.SetActive(true); }
private void Start() { m_animator = GetComponent <Animator>(); m_movement = GetComponent <PlayerMovementScript>(); m_combat = GetComponent <PlayerCombatScript>(); m_movement.BindState(m_state); m_combat.BindState(m_state); m_curHealth = health; }
// Use this for initialization void Start() { if (player == null) { player = GameObject.FindWithTag("Player"); } combatStats = player.GetComponent <PlayerCombatScript>(); experienceBar = gameObject.GetComponent <Image>(); experienceBar.fillAmount = 1; textUI = GetComponentInChildren <Text>(); }
void Start() { Scene scene = SceneManager.GetActiveScene(); if (scene.name == "AR Scene") { playerCombat = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerCombatScript>(); } if (playerCombat == null) { Debug.LogError("Player combat not found"); } }
public override void Execute(Fighter fighterRef, PlayerCombatScript combatScript) { _fighterRef = fighterRef; fighterRef.GetComponent<Animator>().SetTrigger(_dashHash); PlayerControllerScript playerController = fighterRef.GetComponent<PlayerControllerScript>(); playerController.CurrentXSpeed = ((playerController.MaxSpeed + 3) * playerController.getXDirection); if (playerController.CurrentXSpeed > 0) _fighterRef.FacingRight = true; else if (playerController.CurrentXSpeed < 0) _fighterRef.FacingRight = false; StartCoroutine(EndDash()); }
public override void Execute(Fighter fighterRef, PlayerCombatScript combatScript) { this.gameObject.SetActive(true); this.gameObject.GetComponent<SpriteRenderer>().enabled = true; _fighterRef = fighterRef; _combatScript = combatScript; _fighterRef.disableAnimator(); //turn off collisions for fighter ref Rigidbody2D body = this.gameObject.GetComponent<Rigidbody2D>(); if (_airAttack) { //If air attack, dont stop momentum, but pause it on hit. //Create on hit function body.gravityScale = _fighterRef.GetComponent<Rigidbody2D>().gravityScale; Vector2 v = _fighterRef.GetComponent<Rigidbody2D>().velocity; body.velocity = v; if(_isDiveKick) { Vector2 diveSpeed = new Vector2(4, -3); body.velocity = diveSpeed; fighterRef.GetComponent<Rigidbody2D>().velocity = diveSpeed; } } else if(_translate && fighterRef.GetComponent<PlayerControllerScript>()) { Debug.Log("Translate"); fighterRef.GetComponent<PlayerDash>().ForceEndDash(); } else if (_fighterRef.tag == "Player") _fighterRef.GetComponent<PlayerControllerScript>().StopMovement(); if (!_fighterRef.FacingRight) transform.localScale = new Vector3(1, transform.localScale.y, transform.localScale.z); else transform.localScale = new Vector3(-1, transform.localScale.y, transform.localScale.z); }
public virtual void Execute(Fighter fighterRef, PlayerCombatScript combatScript) { }
void Start() { _anim = GetComponent<Animator>(); _combatScript = GetComponent<PlayerCombatScript>(); _fighterRef = this.gameObject.GetComponent<Fighter>(); _instance = this; _playerJump = this.gameObject.AddComponent<Jump>(); _playerJump.JumpSpeed = _jumpSpeed; _playerDash = this.gameObject.AddComponent<PlayerDash>(); }