Ejemplo n.º 1
0
 private void OnErrorInPath(AiEntity e)
 {
     if (e.GetCurrentTile() != null)
     {
         e.SetPath(_aiSystem.CalculateRandomPathByTier(e.GetCurrentTile().GetPosition(), e.getEntityInfo().Tier));
         return;
     }
     e.SetPath(_aiSystem.CalculateRandomPathByTier(new Vector2(1, 1), e.getEntityInfo().Tier));
 }
Ejemplo n.º 2
0
    private void OnDoneInspection(AiEntity e)  // doctor
    {
        e.SetPath(_aiSystem.CalculateRandomPathByTier(e.GetCurrentTile().GetPosition(), e.getEntityInfo().Tier));

        if (e.getEntityInfo().IsDoctor)
        {
            e.OnAtTile -= instance.OnAtTile;
        }
    }
Ejemplo n.º 3
0
    static public void AddAiEntity(AiEntity e)
    {
        instance._aiEntitys.Add(e);

        e.OnEndOfPath      += instance.OnEndOfPath;
        e.OnErrorInPath    += instance.OnErrorInPath;
        e.OnDoneInspection += instance.OnDoneInspection;

        // doctor
        if (e.getEntityInfo().IsDoctor)
        {
            e.OnStartInspection = instance.OnStartInspection;
        }
    }
Ejemplo n.º 4
0
    private void OnStartInspection(AiEntity e)
    {
        if (e.getEntityInfo().IsDoctor)
        {
            if (e.getTarget() == null)
            {
                e.setTarget(this.getSickEntityInRange(e));
            }
            else
            {
                this.doctorCanInspect(e, e.getTarget());
            }

            e.SetPath(_aiSystem.CalulatePathTo(e.GetCurrentTile().GetPosition(), e.getTarget().GetCurrentTile().GetPosition()));
            e.OnAtTile += instance.OnAtTile;
        }
    }
Ejemplo n.º 5
0
    private void OnAtTile(AiEntity e, TileObject t)
    { // doctor
        if (e.getEntityInfo().IsDoctor)
        {
            if (e.getTarget() == null)
            {
                e.setTarget(this.getSickEntityInRange(e));
            }
            else
            {
                this.doctorCanInspect(e, e.getTarget());
            }


            if (e.GetCurrentTile().GetPosition() == e.getTarget().GetCurrentTile().GetPosition())
            {
                return;
            }
            e.SetPath(_aiSystem.CalulatePathTo(e.GetCurrentTile().GetPosition(), e.getTarget().GetCurrentTile().GetPosition()));
        }
    }
Ejemplo n.º 6
0
 static public void SetNewRandomPath(AiEntity e)
 {
     e.SetPath(instance._aiSystem.CalculateRandomPathByTier(e.GetCurrentTile().GetPosition(), e.getEntityInfo().Tier));
 }
Ejemplo n.º 7
0
    private void getPath(AiEntity e)
    {
        if (e.GetCurrentTile() == null)
        {
            return;
        }

        // for normal calulate path to random tile
        e.SetPath(_aiSystem.CalculateRandomPathByTier(e.GetCurrentTile().GetPosition(), e.getEntityInfo().Tier));
    }