Beispiel #1
0
    //Con esta linea inicias una batalla entre dos slimes randoms, usenla para el bien de la nacion slime o7.
    //StartCoroutine(CombatManager.InitBattle((CombatManager.Skins) UnityEngine.Random.Range(0, 9), (CombatManager.Skins) UnityEngine.Random.Range(0, 9), 1));

    public static IEnumerator InitBattle(SlimeData player, SlimeData enemy, int potions)
    {
        Scene          current = SceneManager.GetActiveScene();
        AsyncOperation async   = SceneManager.LoadSceneAsync("Combat Doyo", UnityEngine.SceneManagement.LoadSceneMode.Additive);

        async.allowSceneActivation = true;
        while (!async.isDone)
        {
            yield return(new WaitForSeconds(Time.deltaTime));
        }

        SceneManager.UnloadSceneAsync(current);

        var manager = FindObjectOfType <CombatManager>();

        manager.toCatch = enemy;
        manager.player.Init(manager.fighters[(int)player.type].basicAttack, manager.fighters[(int)player.type].specialAttack, manager.fighters[(int)player.type].model);
        manager.player.LateInit(player.mass, player.type);
        Debug.Log("MP: " + player.mass);
        manager.enemy.Init(manager.fighters[(int)enemy.type].basicAttack, manager.fighters[(int)enemy.type].specialAttack, manager.fighters[(int)enemy.type].model);
        manager.enemy.LateInit(enemy.mass, enemy.type);
        Debug.Log("Enemy: " + enemy.type);

        manager.InitButtons();
    }
    public IEnumerator spawn(SlimeData data)
    {
        GameObject newSlime;

        newSlime = Instantiate(slime);
        newSlime.GetComponent <Transform>().position    = transform.position;
        newSlime.GetComponent <EnemySlimeScript>().data = data;
        newSlime.GetComponent <Transform>().localScale  = new Vector3(data.size * data.scale, data.size * data.scale, data.size * data.scale);
        if (repeat == 0 && transform.root == transform)
        {
            Destroy(this.gameObject);              // removes gameobject when it's finished spawning things
        }
        yield return(null);
    }
Beispiel #3
0
        private void OnMouseDown()
        {
            float m       = (25 - 200) / (maxMass - minMass);
            int   maxLife = (int)(m * mass);

            try
            {
                var d                   = DataManager.LoadData <Data>();
                var acount              = d.GetAcount(Globals.playerName);
                DataSystem.Slime s      = acount.player.GetBestSlime();
                SlimeData        player = new SlimeData(s.mainType, s.life, s.maxLife, s.weight);
                SlimeData        enemy  = new SlimeData(type.ToString(), maxLife, maxLife, mass);
                StartCoroutine(CombatManager.InitBattle(player, enemy, 0));
            }
            catch (System.Exception e)
            {
                Debug.Log("error");
            }
        }
 public SlimeTransform(SlimeTransform _bf)
 {
     SlimeData = _bf.SlimeData;
     Player    = _bf.Player;
 }
 public SlimeTransform(SlimeData _bd)
 {
     SlimeData = _bd;
     Player    = GameObject.FindGameObjectWithTag("Player");
 }