//Assist Execute method public IEnumerator assistExecute() { //Reduce movement for a small second offCD = false; Battle.updatePlayerAOrientation(basis.transform); anim.SetBool("SpAttacking", true); yield return(new WaitForSeconds(ATTACK_DELAY)); //Enable attack if entity isn't stunned if (!basis.isStunned() && basis.transform != null) { if (hitbox == null) //ducktape fix { this.hitbox = Resources.Load <Transform>("MoveHitboxes/BubbleHitbox"); } BubbleBehavior projBehavior = hitbox.GetComponent <BubbleBehavior>(); projBehavior.setUp(basis.transform.position); Transform curBubble = Object.Instantiate(hitbox, basis.transform); curBubble.GetComponent <BubbleBehavior>().currentMove = this; } //Disable animation anim.SetBool("SpAttacking", false); basis.getController().SendMessage("assistExecuted"); }
//Constructor public WaterPulse(Animator anim, PKMNEntity basis) { this.anim = anim; this.basis = basis; this.enemyTag = (anim.tag == "Player") ? "Enemy" : "Player"; //Set variables for hitbox this.hitbox = Resources.Load <Transform>("MoveHitboxes/BubbleHitbox"); BubbleBehavior projProperties = hitbox.GetComponent <BubbleBehavior>(); projProperties.knockbackVal = KNOCKBACK_VAL; projProperties.priority = PROJ_PRIORITY; //set cooldown variables cTimer = 0.0f; offCD = true; }
// Use this for initialization void Start () { GameObject prefab = Resources.Load("Prefabs/Barrier/Barrier", (typeof(GameObject))) as GameObject; barrier = (GameObject) Instantiate(prefab, gameObject.transform.position, Quaternion.identity); barrier.transform.parent = gameObject.transform; bubbleBehavior = barrier.GetComponent<BubbleBehavior>(); }
private void OnCollisionEnter2D(Collision2D collision) { if (collision.gameObject.tag == "Blower") { if (collision.gameObject.transform != gameObject.transform.parent) { if (beenBlown) { anim.SetTrigger("Popped"); collision.gameObject.GetComponent <BlowerBehavior>().AttachResidue(transform.localScale.x); PopMyself(); BubbleResidueOnPlayer(collision.transform.position, collision.transform); CreateStretchyResidue(collision.transform.position, collision.transform); } else { if (collision.gameObject.transform != gameObject.transform.parent) { anim.SetTrigger("Popped"); PopMyself(); BubbleResidueOnPlayer(collision.transform.position, collision.transform); transform.parent.GetComponent <BlowerBehavior>().EarlyPopBubble(); } } } } if (collision.gameObject.tag == "Tooth") { if (transform.parent != null) { anim.SetTrigger("Popped"); PopMyself(); BubbleResidueOnPop(collision.transform.position); transform.parent.GetComponent <BlowerBehavior>().EarlyPopBubble(); } else { anim.SetTrigger("Popped"); PopMyself(); BubbleResidueOnPop(collision.transform.position); } } if (collision.gameObject.tag == "Poppers") { anim.SetTrigger("Popped"); PopMyself(); } if (collision.gameObject.tag == "Bubble") { if (!haveCollided) { //if (Mathf.Abs(collision.gameObject.transform.localScale.x - transform.localScale.x) < 1.5f) if (collision.gameObject.transform.localScale.x > transform.localScale.x) { Vector3 closestCollPoint = collision.contacts[0].point; GameObject tempTape = Instantiate(myTape, new Vector3(closestCollPoint.x, closestCollPoint.y), Quaternion.identity); tempTape.transform.localScale = new Vector3(gameObject.transform.localScale.x * .76f, gameObject.transform.localScale.y * .5f, gameObject.transform.localScale.z * .2f); tempTape.transform.parent = gameObject.transform; } myJoint = gameObject.AddComponent <HingeJoint2D>(); myJoint.connectedBody = collision.gameObject.GetComponent <Rigidbody2D>(); myConnectedBubble = myJoint.connectedBody.GetComponent <BubbleBehavior>(); myJoint.anchor = new Vector2(0, 0); myJoint.connectedAnchor = gameObject.GetComponent <CircleCollider2D>().ClosestPoint(myJoint.connectedBody.transform.position); //myJoint.useMotor = true; //JointMotor2D myMotor = myJoint.motor; //myMotor.motorSpeed = Random.Range(-10.0f, 10.0f); //myJoint.motor = myMotor; // myJoint.autoConfigureConnectedAnchor = false; haveCollided = true; } } }