/* * private void PPossessInitiate() * { * if (Input.GetMouseButtonDown(1) && this.canFirePossess == true) * { * spawnedBlastProjectile = Instantiate(possessProjectile, this.transform.position, this.transform.rotation); * Rigidbody2D possessProjectileRB2D = spawnedBlastProjectile.GetComponent<Rigidbody2D>(); * PossessProjectile possessProjectileScript = spawnedBlastProjectile.GetComponent<PossessProjectile>(); * * possessProjectileScript.Player = this.gameObject; * * Vector2 fireVel = new Vector2(possessFireVel, 0); * if (!isLookingRight) * { * fireVel.x *= -1; * } * * possessProjectileRB2D.velocity = fireVel; * * possessFireCooldownCounter = possessFireCooldownDuration; * } * } * * * public void PPossess(GameObject possessingObject) * { * isPossessing = true; * EntityControlTypeSet(ControlType.OtherControl, true); * entityRB2D.gravityScale = 0; * entityBC2D.enabled = false; * currentPossessingObject = possessingObject; * } * * public void PPossessMovement() * { * if (isPossessing) * { * transform.Translate(currentPossessingObject.transform.position.normalized * 12f * Time.deltaTime); * } * } * * * public void PPossessCancel() * { * currentPossessingObject.GetComponent<PossessableObject>().currentlyPossessed = false; * currentPossessingObject = null; * * EntityControlTypeSet(ControlType.CanControl, true); * entityRB2D.gravityScale = 2; * entityBC2D.enabled = true; * entityRB2D.velocity = new Vector2(entityRB2D.velocity.x, 7f); * isPossessing = false; * } */ private void PBlastAttack() { if (Input.GetMouseButtonDown(0) && canFireBlast == true) { spawnedBlastProjectile = Instantiate(blastProjectile, this.transform.position, this.transform.rotation); Rigidbody2D blastProjectileRB2D = spawnedBlastProjectile.GetComponent <Rigidbody2D>(); BlastProjectile blastProjectileScript = spawnedBlastProjectile.GetComponent <BlastProjectile>(); Attack blastAttack = new Attack(blastDamage, true, this.gameObject, blastKnockback); blastProjectileScript.attackObject = blastAttack; Vector2 fireVel = new Vector2(blastFireVel, 0); if (!isLookingRight) { fireVel.x *= -1; } blastProjectileRB2D.velocity = fireVel; blastCooldownCounter = blastCooldownDuration; } }
private void PBlastAttack() { Debug.Log("Are we here"); if (CanActivate) { spawnedBlastProjectile = Instantiate(blastProjectile, this.transform.position, this.transform.rotation); Rigidbody2D blastProjectileRB2D = spawnedBlastProjectile.GetComponent <Rigidbody2D>(); BlastProjectile blastProjectileScript = spawnedBlastProjectile.GetComponent <BlastProjectile>(); Attack blastAttack = new Attack(blastDamage, gameObject, blastKnockback); blastProjectileScript.attackObject = blastAttack; Vector2 fireVel = new Vector2(blastFireVel, 0); if (!aEntity.isLookingRight) { fireVel.x *= -1; } blastProjectileRB2D.velocity = fireVel; blastCooldownCounter = blastCooldownDuration; CanActivate = false; } }