Beispiel #1
0
 private void Start()
 {
     InitiateAnimal();
     hireUnit     = GetComponent <HireUnit>();
     alerting     = GameObject.FindGameObjectWithTag("Resourses").GetComponent <CampAlertSystem>();
     guitarMusicI = -1;
     ShakeGuitarMusic();
 }
Beispiel #2
0
    public GameObject SpawnNewHunter(int health)
    {
        GameObject newpony = PoolManager.getGameObjectFromPool(earthponyPrefab);
        Earthpony  newPony = newpony.GetComponent <Earthpony>();

        newPony.gameManager = gameManager; //для настройки звуков
        for (int i = 0; i < newPony.randomColors.Length; i++)
        {
            newPony.randomColors[i].enabled = false;
        }
        newPony.hunter = true;
        newPony.unit   = true;
        newPony.Bow.SetActive(true);
        newPony.Bow.GetComponent <SpriteRenderer>().flipX = newPony.GetComponent <SpriteRenderer>().flipX;
        newPony.hasBow             = true;
        newPony.transform.parent   = null;
        newPony.myOrder            = gameManager.earthponiesCount + 6;
        newPony.transform.position = new Vector3(transform.position.x + Random.Range(-10, 42), -0.83f, -1);
        newPony.myHome             = this;
        newPony.health             = health;
        newPony.maxX        = -28.61f;
        newPony.minX        = -99.34f;
        newPony.Camera      = MainCamera;
        newPony.Timberwolf1 = timberWolf1;
        newPony.Timberwolf2 = timberWolf2;
        newPony.ursa        = Ursa;
        newPony.UniSpawn    = UniSpawn;
        newPony.PegaSpawn   = PegaSpawn;
        newPony.fire        = fire;
        HireUnit hireUnit = newpony.GetComponent <HireUnit>();

        if (controller == null)
        {
            controller = Player.GetComponent <MovingController>();
        }
        hireUnit.Cloth.originSR = controller.clothAnimator.GetComponent <SpriteRenderer>();
        hireUnit.Hood.enabled   = hireUnit.Cloth.enabled = true;
        newPony.GetComponent <EarthponyMovingController>().ForgetColors();

        hireUnit.Player      = controller;
        hireUnit.gameManager = gameManager; //для обработки паузы - чтоб кнопки не нажимались
        hireUnit.res         = res;
        hireUnit.mainCamp    = mainCamp;
        hireUnit.HintText    = hintText;
        hireUnit.enabled     = false;
        gameManager.earthponiesCount++;
        Hunters.Add(newPony);
        res.Ponies++;

        return(newpony);
    }
Beispiel #3
0
    void SpawnPony()
    {
        GameObject newpony = PoolManager.getGameObjectFromPool(earthponyPrefab);
        Earthpony  newPony = newpony.GetComponent <Earthpony>();

        newPony.gameManager        = gameManager; //для настройки звуков
        newPony.myOrder            = gameManager.earthponiesCount + 6;
        newPony.transform.parent   = null;
        newPony.transform.position = new Vector3(transform.position.x + Random.Range(-10, 10), -0.83f, -1);
        newPony.myHome             = this;
        newPony.health             = 50;
        newPony.maxX        = maxX;
        newPony.minX        = minX;
        newPony.Camera      = MainCamera;
        newPony.Timberwolf1 = timberWolf1;
        newPony.Timberwolf2 = timberWolf2;
        newPony.ursa        = Ursa;
        newPony.UniSpawn    = UniSpawn;
        newPony.PegaSpawn   = PegaSpawn;
        newPony.fire        = fire;
        newPony.GetComponent <RandomSex>().newPony   = true;
        newPony.GetComponent <RandomColor>().newPony = true;
        newPony.deadTimer   = 2f;
        newPony.onetimeDead = false;
        RandomColor[] otherColors = newPony.GetComponentsInChildren <RandomColor>();
        for (int i = 0; i < otherColors.Length; i++)
        {
            otherColors[i].newPony = true;
        }
        newPony.GetComponent <EarthponyMovingController>().ForgetColors();
        HireUnit hireUnit = newpony.GetComponent <HireUnit>();

        hireUnit.gameManager = gameManager; //для обработки паузы - чтоб кнопки не нажимались
        hireUnit.res         = res;
        hireUnit.mainCamp    = mainCamp;
        hireUnit.HintText    = hintText;
        gameManager.earthponiesCount++;

        Ponies.Add(newPony);
        PoniesWalk.Add(true);
    }