protected override void OnPurchase(EntityPlayer player) { Destroy(player.GetComponent <PlayerAttack>()); PlayerAttackMelee pam = player.gameObject.AddComponent <PlayerAttackMelee>(); pam.damage = this.damage; pam.attackAnimation = this.attackAnimation; }
// Use this for initialization void Start () { s_attackMelee = GetComponent<PlayerAttackMelee> (); s_attackRanged = GetComponent<PlayerAttackRanged> (); s_movement = GetComponent<PlayerMovement> (); s_attackMelee.enabled = true; s_attackRanged.enabled = false; aiu_combatToggle = false; health = 100; }
// need to get isBlocking from PlayerAttackMelee.cs void Awake () { //aiu stands for "axis in use"; acts like a toggle aiu_crouch = false; aiu_jump = false; facingRight = true; isCrouching = false; isPerformingAction = false; isGrounded = true; rb = GetComponent<Rigidbody2D> (); rb.freezeRotation = true; s_attackMelee = GetComponent<PlayerAttackMelee> (); s_attackRanged = GetComponent<PlayerAttackRanged> (); transform.localScale = new Vector3 (DEF_PLAYER_WIDTH, DEF_PLAYER_HEIGHT, 1f); moveSpeed = 5f; jumpHeight = 1f; }