コード例 #1
0
 // Use this for initialization
 void Start()
 {
     base.Start();
     amelia    = GameObject.FindGameObjectWithTag("Amelia").GetComponent <Amelia> ();
     initialCd = cd;
     numberCdText.transform.position = transform.position;
 }
コード例 #2
0
    // 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;
    }
コード例 #3
0
    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")
            {
            }
        }
    }
コード例 #4
0
 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();
     }
 }
コード例 #5
0
ファイル: Enemy.cs プロジェクト: mateussnogs/Gate-Keeper
    // 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;
    }
コード例 #6
0
ファイル: Spear.cs プロジェクト: mateussnogs/Gate-Keeper
 public Spear(Amelia amelia, int dmg, float atkTime, GameObject spear) : base(amelia, dmg, atkTime)
 {
     this.spear = spear;
 }
コード例 #7
0
 void Start()
 {
     amelia = GetComponent <Amelia> ();
     anim   = GetComponent <Animator> ();
 }
コード例 #8
0
 public Sword(Amelia amelia, int dmg, float atkTime) : base(amelia, dmg, atkTime)
 {
 }
コード例 #9
0
 // Use this for initialization
 void Start()
 {
     amelia = transform.parent.gameObject.GetComponent <Amelia> ();
 }
コード例 #10
0
 public static int weaponBreakChance = 100;     // sempre acerta
 public Axe(Amelia amelia, int dmg, float atkTime) : base(amelia, dmg, atkTime)
 {
 }
コード例 #11
0
 // Use this for initialization
 public Weapon(Amelia amelia, int dmg, float atkTime)
 {
     this.dmg     = dmg;
     this.atkTime = atkTime;
     this.amelia  = amelia;
 }