コード例 #1
0
    private PowerUp SudoFactory(RunnerPowerUpManager picker, Type powerUpType)
    {
        if (powerUpType == typeof(PowerUp))
        {
            return(null);
        }

        Type[]          constructorParameters = { typeof(RunnerPowerUpManager) };
        ConstructorInfo constructorInfo       = powerUpType.GetConstructor(constructorParameters);

        if (constructorInfo != null)
        {
            return(constructorInfo.Invoke(new object[] { picker }) as PowerUp);
        }

        return(null);
    }
コード例 #2
0
    // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
    override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        if (_ai == null)
        {
            _ai = animator.GetComponent <Ai>();
        }

        if (_fov == null)
        {
            _fov = animator.GetComponent <FieldOfView>();
        }

        if (_runnerPowerUpManager == null)
        {
            _runnerPowerUpManager = animator.GetComponent <RunnerPowerUpManager>();
        }

        _runnerPowerUpManager.OnPowerUpChanged += ListenToPowerUpChange;
        _ai.UpdateDestination();
    }
コード例 #3
0
 public PowerUp PickUpPower(RunnerPowerUpManager picker)
 {
     return(SudoFactory(picker, _powerUpTypes[Random.Range(0, _powerUpTypes.Length)]));
 }
コード例 #4
0
 public PowerUp(RunnerPowerUpManager powerUpManager)
 {
     _owner = powerUpManager;
 }
コード例 #5
0
 public StunBox(RunnerPowerUpManager powerUpManager) : base(powerUpManager)
 {
 }
コード例 #6
0
 public BowlingBall(RunnerPowerUpManager powerUpManager) : base(powerUpManager)
 {
 }
コード例 #7
0
 public SwiftnessPotion(RunnerPowerUpManager powerUpManager) : base(powerUpManager)
 {
 }
コード例 #8
0
 private void OnEnable()
 {
     Instance       = this;
     PowerUpManager = this.GetComponent <RunnerPowerUpManager>();
 }