示例#1
0
 public void RemoveActorFromScene(ControllableActor actor)
 {
     if (actor != null && controllableSceneActors.Contains(actor))
     {
         controllableSceneActors.Remove(actor);
     }
 }
示例#2
0
 public bool TryEquipNewActor(ControllableActor actor)
 {
     if (!HasActor())
     {
         ChangeControlledActor(actor);
     }
     return(HasActor());
 }
示例#3
0
 // Initialize the team member with a team, then link them to inputs, then try to get an actor
 public TeamMember(Player player, Teams team)
 {
     this.player     = player;
     controlledActor = null;
     myTeam          = team;
     RegisterPlayerInput();
     ChangeControlledActor(SearchForNewActor());
 }
示例#4
0
 public void AddActorToScene(ControllableActor actor)
 {
     if (actor != null && !controllableSceneActors.Contains(actor))
     {
         controllableSceneActors.Add(actor);
     }
     if (OnActorRegister != null)
     {
         OnActorRegister(actor);
     }
 }
示例#5
0
 void Awake()
 {
     aggroTrigger      = GetComponent <SphereCollider>();
     controllableActor = GetComponent <ControllableActor>();
     animState         = GetComponent <AnimationState>();
     damageState       = GetComponent <ContinuousDamageController>();
     myRegister        = GetComponent <ActorTeamRegister>();
     myTrans           = transform;
     status            = GetComponent <Status>();
     status.OnDamage  += SwitchTargetOnDamage;
     status.OnHPZero  += HPZeroCallback;
 }
示例#6
0
 void ChangeControlledActor(ControllableActor newActor)
 {
     changing = true;
     if (newActor != null && newActor.IsUncontrolled())
     {
         newActor.SetToControlled(player.controllers.Joysticks);
         ReleaseControlledActor();
         controlledActor     = newActor;
         currentActorActions = controlledActor.GetAllAvailableActions();
         LinkInputToControlledActor(currentActorActions);
         controlledActor.OnRemoveFromScene += ReleaseControlledActor;
     }
     changing = false;
 }
示例#7
0
 void ReleaseControlledActor()
 {
     if (controlledActor != null)
     {
         Debug.Log("Releasing control over the actor");
         controlledActor.OnRemoveFromScene -= ReleaseControlledActor;
         controlledActor.SetToUncontrolled();
         DelinkInputToControlledActor(currentActorActions);
         controlledActor = null;
     }
     if (!changing)
     {
         // This will still be called when you switch teams
         ChangeControlledActor(SearchForNewActor());
     }
 }
示例#8
0
 void ActorRegistered(ControllableActor actor)
 {
     newRegisteredActors.Add(actor);
 }
示例#9
0
    public LinkedList <ControllableActor> GetAlliedUncontrolledActors(Teams alliedTeam, ControllableActor current)
    {
        List <ControllableActor> eligibleActors = new List <ControllableActor>();

        foreach (var actor in controllableSceneActors)
        {
            var validActor            = actor != null && actor.GetTeam() == alliedTeam;
            var currentlyControllable = actor.IsUncontrolled() || actor == current;
            if (validActor && currentlyControllable)
            {
                eligibleActors.Add(actor);
            }
        }
        eligibleActors.OrderBy(a => a.isHighPriorityActor);
        return(new LinkedList <ControllableActor>(eligibleActors));
    }