//private Attack weapon;

    // Use this for initialization
    void Start()
    {
        GameObject obj = GameObject.FindWithTag("GameController");

        gameController = obj.GetComponent <RandomDrop>();
        //GameObject wpn = GameObject.FindWithTag ("Weapon");
        //weapon = wpn.GetComponent<Attack> ();
        //weapon = GetComponent<Attack> ();
        GameObject[] model = GameObject.FindGameObjectsWithTag("Animated");

        if (model == null)
        {
            Debug.Log("no model");
        }
        foreach (GameObject m in model)
        {
            Debug.Log(m.name);
            anim = m.GetComponent <CharAnim> ();
            if (anim == null)
            {
                Debug.Log("no anim");
            }
        }

        wings.SetActive(false);
        boltcarry.SetActive(false);
    }
Esempio n. 2
0
    // Use this for initialization
    void Start()
    {
        GameObject obj = GameObject.FindWithTag("GameController");

        gameController = obj.GetComponent <RandomDrop>();
        win            = obj.GetComponent <WinLoseMessage> ();
        GameObject p = GameObject.FindWithTag("Player");

        pController = p.GetComponent <PlayerController> ();
    }
Esempio n. 3
0
    // Use this for initialization
    void Start()
    {
        ultrabar1.SetActive(false);
        ultrabar2.SetActive(false);
        ultrabar3.SetActive(false);
        harp.SetActive(false);
        GameObject obj = GameObject.FindWithTag("GameController");

        gameController = obj.GetComponent <RandomDrop>();
        player         = GameObject.FindWithTag("Player");
    }
Esempio n. 4
0
        public override string ToString()
        {
            if (drops.Count == 0 && randomDrops.Count == 0)
            {
                return(null);
            }

            StringBuilder sb = new StringBuilder();

            for (int i = 0; i < drops.Count; i++)
            {
                Drop d = drops[i];

                if (d.chance < 100)
                {
                    sb.Append(d.chance + "% chance ");
                }

                if (d.type == typeof(DnaItem))
                {
                    sb.Append(d.level + " DNA");
                }
                else if (d.type == typeof(XpItem))
                {
                    sb.Append(d.level + " XP");
                }
                else
                {
                    sb.Append(d.type.Name);
                }

                //if (i + 1 == drops.Count)
                sb.Append("\n");
            }

            for (int i = 0; i < randomDrops.Count; i++)
            {
                RandomDrop d = randomDrops[i];

                if (d.chance < 100)
                {
                    sb.Append(d.chance + "% chance ");
                }

                sb.Append("random " + d.type.ToString());

                if (i + 1 != drops.Count)
                {
                    sb.Append("\n");
                }
            }

            return(Utils.StringWrap(sb.ToString(), 50));
        }
Esempio n. 5
0
 public void TakeDamage(float damage)
 {
     CinemachineShake.Instance.ShakeCamera(3f, 0.2f);
     health -= (int)damage;
     if (health <= 0)
     {
         RandomDrop.SpawnRandomDrop(transform.position, Quaternion.identity);
         Destroy(this.gameObject, 0.1f);
     }
     rb.AddForce(hitForce, ForceMode2D.Impulse);
     Debug.Log(health);
 }
Esempio n. 6
0
    public void TakeDamage(float damage, bool hitFromRight)
    {
        PlayDamageEffect();

        health -= (int)damage;

        hitForce.x *= hitFromRight ? -1 : 1;

        rb.drag = drag;

        rb.AddForce(hitForce, ForceMode2D.Impulse);

        if (health <= 0)
        {
            RandomDrop.SpawnRandomDrop(transform.position, Quaternion.identity);
            Destroy(this.gameObject, 0.1f);
        }
        Debug.Log(health);
    }
Esempio n. 7
0
    public void TakeDamage(float damage, bool hitFromRight)
    {
        PlayDamageEffect();
        damagedState.HitSide(hitFromRight);
        damagedState.SetHitForce(hitForce.x, hitForce.y);
        StateMachine.ChangeState(damagedState);

        currentHealth -= (int)damage;

        CinemachineShake.Instance.ShakeCamera(3f, 0.2f);

        if (currentHealth <= 0)
        {
            if (enemyDelegate != null)
            {
                enemyDelegate(this);
            }
            RandomDrop.SpawnRandomDrop(AliveGO.transform.position, Quaternion.identity);
            Destroy(this.gameObject, 0.1f);
        }
        Debug.Log(EnemyName + " " + currentHealth);

        // Debug.Log(EnemyDelegateCount);
    }