Beispiel #1
0
    void drawButton()
    {
        EditorGUILayout.BeginHorizontal();

        EditorGUILayout.BeginVertical();
        EditorGUILayout.EndVertical();
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.BeginVertical();
        EditorGUILayout.BeginVertical();
        ammo = EditorGUILayout.TextField(label: "Add Ammo: ", ammo);
        EditorGUILayout.EndVertical();

        EditorGUILayout.BeginVertical();
        if (GUILayout.Button("Add Specific Ammo"))
        {
            int.TryParse(ammo, out int damage);
            baseClass.AddAmmo(damage);
        }
        if (GUILayout.Button("Add Max Ammo"))
        {
            baseClass.AddAmmo(baseClass.AmmoLimit);
        }

        EditorGUILayout.EndVertical();
        GUILayout.EndHorizontal();
    }
Beispiel #2
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.tag == "Area")
        {
            Debug.Log("CHANGE AREA");
            //if(lastArea!=null)
            //{
            //    lastArea.DisableEnemies();
            //}
            currentArea = collision.GetComponent <Area>();

            //currentArea.EnableEnemies();

            //lastArea = currentArea;
            if (!changearea)
            {
                StartCoroutine(ChangeArea(collision.transform.position));
            }
        }


        if (collision.tag == "Teleport")
        {
            Debug.Log("TELE INDORS");

            tele = collision.gameObject.GetComponent <Teleporter>();
            StartCoroutine(TeleportPlayer());
        }

        //if (damageable)
        //{
        //    if (collision.tag == "Enemy")
        //    {
        //        Damageable.CollisionInfo i = new Damageable.CollisionInfo();
        //        i.position = collision.transform.position;
        //        i.totalDmg = 1;


        //        damageable.DealDamage(i);
        //        //PlayHitStun();
        //        Debug.Log("OUCH");
        //    }

        //    if (collision.tag == "Health1")
        //    {
        //        damageable.HealAdditive(3);

        //        Destroy(collision.gameObject);

        //    }



        //}

        //if (collision.tag == "Fire")
        //{
        //    Debug.Log("BURN");

        //    Status.StartBurning();

        //}


        //--------------------------------
        if (collision.tag == "Gold")
        {
            Debug.Log("COIN");
            if (OnCollectCoin != null)
            {
                OnCollectCoin(100);
            }

            Destroy(collision.gameObject);

            //Debug.Log("BURN");

            //Status.StartBurning();
        }
        //if (collision.tag == "HealthUp")
        //{
        //    damageable.UpgradeHealth(2);
        //    sfx.PlayOneShot(healthSFX);
        //    Destroy(collision.gameObject);

        //}
        if (collision.tag == "Heal")
        {
            damageable.HealAdditive(12);
            sfx.PlayOneShot(healthSFX);
            Destroy(collision.gameObject);
        }
        if (collision.tag == "ArrowCollect")
        {
            //damageable.HealAdditive(1);

            bow.AddAmmo(3);
            sfx.PlayOneShot(healthSFX);
            Destroy(collision.gameObject);
        }
        if (collision.tag == "BombCollect")
        {
            //damageable.HealAdditive(1);

            bomb.AddAmmo(3);
            sfx.PlayOneShot(healthSFX);
            Destroy(collision.gameObject);
        }

        //-------------------------------------


        //if(collision.gameObject.layer==LayerMask.NameToLayer("Collectable"))
        //{
        //    Debug.Log("Collect");
        //    collision.GetComponent<Collectable>().OnCollect.Invoke();
        //}



        if (collision.tag == "Projectile")
        {
            collision.GetComponent <Projectile>().CleanUp.Invoke();

            Damageable.CollisionInfo i = new Damageable.CollisionInfo();
            i.position = -collision.transform.position;
            i.totalDmg = 1;

            bow.Dispose();
            damageable.DealDamage(i);
        }

        //collision.
        //Debug.Log(collision.name);
    }