protected override void Update() { if (victim != null) { if (lifetime > airTime) { victim.transform.position += new Vector3(0f, 0.9f * Time.deltaTime, 0f); } if (lifetime < fadeTime) { sr.color = new Color(1f, 1f, 1f, (fadeTime - lifetime) / fadeTime); transform.localScale -= scaleVector * Time.deltaTime; } transform.Rotate(rotVector * Time.deltaTime); transform.position = victim.transform.position; if (victim.transform.position.x > GameVars.WallRightSoft) { victim.IS_FACING_RIGHT = false; } else if (victim.transform.position.x < GameVars.WallLeftSoft) { victim.IS_FACING_RIGHT = true; } victim.Scare(1); base.Update(); } else { Finish(); } }
private void OnTriggerEnter2D(Collider2D other) { if (other.CompareTag("Person")) { Person2 p = other.transform.GetComponent <Person2>(); p.Scare(damage); // Debug.Log ("Scaring for "+damage+" damage."); } }
private void OnTriggerEnter2D(Collider2D other) { if (other.CompareTag("Person")) { //Debug.Log ("Spider collided with person"); Person2 p = other.transform.GetComponent <Person2>(); p.Scare(damage); } // else { //Debug.Log ("Spider collided with non-person"); //} }
private void OnTriggerEnter2D(Collider2D other) { if (other.CompareTag("Person")) { Person2 p = other.GetComponent <Person2>(); p.Scare(damage); } if (!grounded) { // the monster doesn't jump, so only check this once if (other.CompareTag("Solid") && other.transform.position.y < this.transform.position.y) { grounded = true; fallspeed = 0f; } } }
public void SetVictim(GameObject g) { victim = g.GetComponent <Person2>(); victim.Scare(damage); victim.SetPossessed(true); }
public override void Flip(Person2 p) { Flip(); p.Scare(damage); }