public override void SetDestination(Vector3 destination, ShooterCharacter emissor)
    {
        base.SetDestination(destination, emissor);
        lineRenderer.positionCount = 2;
        lineRenderer.startWidth    = startWidth;
        lineRenderer.endWidth      = endWidth;
        lineRenderer.SetPosition(0, transform.position);
        lineRenderer.SetPosition(1, destination);

        AliveCreature aliveCreature = GetAttackedPlayer(transform.position, destination);

        if (aliveCreature)
        {
            aliveCreature.DealDamage(emissor.damage);
        }

        Invoke("EndEmissorAction", delayToDestroy);
    }
Ejemplo n.º 2
0
    /*private void updateGaugesOnTraitModified(Trait updated, Creature changed)
     * {
     *  configGauges.InitializeGauges(changed, false, true, false);
     *  changed.ColorSwap.Swap(CreatureTraits.GetColor(changed.Traits));
     * }*/

    public void DestroyCreature(Creature toDestroy)
    {
        int specieID = toDestroy.SpecieID;

        //Metrics.NotifyCreatureDied(refToDestroy.values);
        aliveCreatures.Remove(toDestroy);
        //ARDUINO ISLAND
        if (CreatureCountTable != null)
        {
            --CreatureCountTable[toDestroy.SpecieID];
        }

        // Jirachi
        creaturePopulationChangedEvent?.Invoke();

        // Lucas
        DeadCreature?.Invoke();
        //TODO je me suis permis de commenter le debug parce que ça fait longtemps qu'il est là
        //Debug.Log("OK");
        toDestroy.CreatureDoing.CreatureEatCreature -= CreatureEatCreature;
        toDestroy.CreatureDoing.CreatureEatFood     -= CreatureEatFood;

        /*Debug.Log("--------------CreatureList-------------");
         * foreach (int specie in CreatureCountTable)
         * {
         *  Debug.Log(specie);
         * }
         * Debug.Log("-----------");*/
        //
        Destroy(toDestroy.gameObject);

        Nest nest = nests != null?nests.FirstOrDefault(n => n.SpecieID == specieID) : null;

        if (AliveCreature.Sum(creature => creature.SpecieID == specieID ? 1 : 0) == 0 && nest)
        {
            List <Creature> creatures = CreateCreaturesFromConfig(specieID, 8);
            foreach (Creature creature in creatures)
            {
                creature.transform.parent   = IslandGenerator.Instance.transform;
                creature.transform.position = nest.transform.position + Vector3.up * 0.5f;
                creature.gameObject.SetActive(true);
            }
        }
    }