Beispiel #1
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;
 }
    void Update()
    {
        // If we actually are controllable, and we are controlled, do nothing
        if (isControllable && !controllableActor.IsUncontrolled())
        {
            return;
        }
        // if we don't have a target, get one or shut down ai
        if (currentTarget == null)
        {
            AquireTarget();
        }
        else if (!ProcessCurrentTargetValidity(currentTarget))     // If current target is not valid, set to null
        {
            currentTarget = null;
        }
        var state = ProcessControls();

        animState.ProcessAnimation(state);
        damageState.ProcessAttack(state);
    }