Beispiel #1
0
    public void EvacSheep(HerdMember sheep, Action OnComplete)
    {
        sheep.DisableUI();
        sheep.GetComponent <SheepComponent>().AIenabled = false;

        Game.Instance.sfx.PlaySaveMouton();
        Sequence sqc = DOTween.Sequence();

        MoveToCheckpoint(sheep.transform, (Vector2)plateformCheckpoint.transform.position, sqc);
        sqc.AppendCallback(() =>
        {
            Instantiate(sheepCaughtPrefab, popUpLocation.transform.position, Quaternion.identity);
        });
        MoveToCheckpoint(sheep.transform, (Vector2)camionCheckpoint.transform.position, sqc);
        sqc.OnComplete(() =>
        {
            sheep.Evac(null);
            OnComplete.Invoke();
        });
    }
    public void SpawnPref(int NbToSpawn)
    {
        Vector3 pos;

        for (int i = 0; i < NbToSpawn; i++)
        {
            GameObject newSheep = null;
            pos = new Vector3(Random.Range(m_xMin, m_xMax), Random.Range(m_yMin, m_yMax));
            if (Random.Range(0.0f, 1.0f) <= chanceOfSpawningBlackSheep)
            {
                newSheep = Instantiate(blackSheepPrefab, pos, Quaternion.identity, m_UnitContain);
            }
            else
            {
                newSheep = Instantiate(m_SheepPrefab, pos, Quaternion.identity, m_UnitContain);
            }
            HerdMember member = newSheep.GetComponent <HerdMember>();
            if (member)
            {
                member.DisableUI();
            }
        }
    }