// Use this for initialization void Start() { base.Start(); amelia = GameObject.FindGameObjectWithTag("Amelia").GetComponent <Amelia> (); initialCd = cd; numberCdText.transform.position = transform.position; }
// Use this for initialization void Start() { amelia = GameObject.FindGameObjectWithTag("Amelia").GetComponent <Amelia>(); if (amelia.transform.position.x > transform.position.x) { ChangeDirection(); } targetDir = (amelia.transform.position - transform.position).normalized; GetComponent <Rigidbody2D> ().velocity = targetDir * speed; }
void OnTriggerEnter2D(Collider2D other) { if (gameObject.tag == "AtkAmelia") { if (other.gameObject.tag == "Knight" || other.gameObject.tag == "Enemy") { switch (atkMode) { case AttackMode.Spear: other.gameObject.GetComponent <Enemy> ().Attacked(1); break; case AttackMode.Axe: other.gameObject.GetComponent <Enemy> ().Attacked(2); break; case AttackMode.Sword: other.gameObject.GetComponent <Enemy> ().Attacked(1); break; } } //other.gameObject.GetComponent<Knight2> ().Attacked (); } else if (gameObject.tag == "AtkKnight") { if (other.gameObject.tag == "Amelia") { Amelia amelia = other.gameObject.GetComponent <Amelia> (); Knight2 knight = transform.parent.gameObject.GetComponent <Knight2> (); if (knight.state != Knight2.State.Attacked) { amelia.GetHit(knight.gameObject); } } else if (other.gameObject.tag == "Gate") { if (transform.parent.gameObject.GetComponent <Knight2> ().canHitTower) { gate.GetHit(1); } } else if (other.gameObject.tag == "ShieldBlock") { } } }
void OnTriggerEnter2D(Collider2D other) { if (other.gameObject.tag == "Amelia") { amelia = other.gameObject.GetComponent <Amelia> (); if (knight.state != Knight2.State.Attacked) { amelia.GetHit(knight.gameObject); } } else if (other.gameObject.tag == "Gate") { if (transform.parent.gameObject.GetComponent <Knight2> ().canHitTower) { gate.GetHit(1); } } else if (other.gameObject.tag == "ShieldBlock") { knight.Stun(); } }
// Use this for initialization public virtual void Start() { Physics2D.IgnoreLayerCollision(LayerMask.NameToLayer("Enemy"), LayerMask.NameToLayer("Button")); dmgText = GameObject.FindGameObjectWithTag("DmgText").GetComponent <Text>(); anim = GetComponent <Animator> (); amelia = GameObject.FindGameObjectWithTag("Amelia").GetComponent <Amelia>(); if (amelia == null) { amelia = GameObject.FindGameObjectWithTag("Amelia").GetComponent <Amelia>(); } else { target = amelia.gameObject; } if (transform.childCount > 0 && transform.GetChild(0) != null) { atkCollider = transform.GetChild(0).gameObject; } spriteRenderer = GetComponent <SpriteRenderer> (); originalColor = spriteRenderer.color; }
public Spear(Amelia amelia, int dmg, float atkTime, GameObject spear) : base(amelia, dmg, atkTime) { this.spear = spear; }
void Start() { amelia = GetComponent <Amelia> (); anim = GetComponent <Animator> (); }
public Sword(Amelia amelia, int dmg, float atkTime) : base(amelia, dmg, atkTime) { }
// Use this for initialization void Start() { amelia = transform.parent.gameObject.GetComponent <Amelia> (); }
public static int weaponBreakChance = 100; // sempre acerta public Axe(Amelia amelia, int dmg, float atkTime) : base(amelia, dmg, atkTime) { }
// Use this for initialization public Weapon(Amelia amelia, int dmg, float atkTime) { this.dmg = dmg; this.atkTime = atkTime; this.amelia = amelia; }