public override void OnShoot(LivingBeing pShotThing)
    {
        AI tAI = pShotThing.GetComponent<AI>();
        Assert.IsNotNull(tAI, "Trying to persuade non-AI target?");

        tAI.Persuade(m_pWielder);
    }
Exemple #2
0
    public override void OnShoot(LivingBeing pShotThing)
    {
        AI tAI = pShotThing.GetComponent <AI>();

        Assert.IsNotNull(tAI, "Trying to persuade non-AI target?");

        tAI.Persuade(m_pWielder);
    }
    private IEnumerator ChanceToGrowPlant()
    {
        while (true)
        {
            float averagePlantTime = 1f / (_plantsPerSecond + Mathf.Epsilon);
            float nextPlantTime    = Random.Range(0.8f * averagePlantTime, 1.2f * averagePlantTime);
            yield return(new WaitForSeconds(nextPlantTime));

            if (_statsManager.CanCreatePlants())
            {
                if (SuitablePositionFound())
                {
                    LivingBeing newPlant = Instantiate(_plantPrefab, _newWorldPos, Quaternion.identity);
                    newPlant.transform.parent = transform;
                    Collider newPlantCollider = newPlant.GetComponent <Collider>();
                    newPlantCollider.enabled = false;

                    StartCoroutine(GrowPlant(newPlant, newPlantCollider));
                }
            }
        }
    }