Beispiel #1
0
    public override IEntityCallbackUser CreateController()
    {
        ChaserController c = SelfTypeCreatorFactory <EntityController> .Create <ChaserController>();

        c.UseConfig(this);
        return(c);
    }
Beispiel #2
0
    public override void UpdateCommands(Entity entity, ChaserController controller, TargettingModule targettingModule, WanderingModule wanderingModule)
    {
        Entity target = targettingModule.SeekAndSetTarget(entity);

        if (target != null)
        {
            wanderingModule.IsControllingVelocity = false;
            wanderingModule.ResetCycle();
            controller.SetNextState(new ChasingState());
            return;
        }
        controller.IssueCommand(wanderingModule.CycleAndGetCommand(controller.WanderSpeedMultiplier * entity.GetStat(GameInfo.Stats.MoveSpeed)));
    }
Beispiel #3
0
    // When the player exits the fishing zone, tell it you can't fish no more
    private void OnTriggerExit2D(Collider2D other)
    {
        PlayerController controller = other.GetComponent <PlayerController>();
        ChaserController NPCControl = other.GetComponent <ChaserController>();

        if (controller != null)
        {
            //controller.Hide();
        }
        else if (NPCControl != null)
        {
            NPCControl.inHideZone = false;
        }
    }
Beispiel #4
0
    public override void UpdateCommands(Entity entity, ChaserController controller, TargettingModule targettingModule, WanderingModule wanderingModule)
    {
        Action <Entity> cmd = (!targettingModule.Target?.IsDead ?? false) ? Behaviours.MoveToTargetIfInRangeAndSight(entity, targettingModule.Target, controller.ChaseDistance) : null;

        if (cmd == null)
        {
            wanderingModule.ForceVelocity(entity.Velocity);
            wanderingModule.SetSeedDirection(UnityEngine.Vector2.zero);
            wanderingModule.SetCycleStage(WanderingModule.CycleStage.StopPoint, -50);
            controller.SetNextState(new ChaserWanderingState());
            return;
        }
        controller.IssueCommand(cmd);
    }
Beispiel #5
0
    void OnTriggerEnter2D(Collider2D other)
    {
        PlayerController controller = other.GetComponent <PlayerController>();
        ChaserController NPCControl = other.GetComponent <ChaserController>();

        if (controller != null)
        {
            controller.Hide();
        }
        else if (NPCControl != null)
        {
            Debug.Log("In hide zone!");
            NPCControl.Hide();
            NPCControl.inHideZone = true;
        }
    }
Beispiel #6
0
 public abstract void UpdateCommands(Entity entity, ChaserController controller, TargettingModule targettingModule, WanderingModule wanderingModule);