예제 #1
0
        public override bool InstantExecute(GameObject target, IAction[] actions, int index)
        {
            CharacterShooter charShooter = this.shooter.GetComponent <CharacterShooter>(target);

            if (charShooter == null)
            {
                Debug.LogError("Target Game Object does not have a CharacterShooter component");
                return(true);
            }

            Transform      targetTransform = this.target.GetTransform(target);
            TargetPosition targetPosition  = new TargetPosition(TargetPosition.Target.Transform);

            targetPosition.targetTransform = targetTransform;

            switch (this.aim)
            {
            case AimDirection.StopAiming:
                charShooter.StopAiming();
                break;

            case AimDirection.AimCameraDirection:
                charShooter.StartAiming(new AimingCameraDirection(charShooter));
                break;

            case AimDirection.AimAtTarget:
                AimingAtTarget aimingTarget = new AimingAtTarget(charShooter);
                aimingTarget.Setup(this.target);
                charShooter.StartAiming(aimingTarget);
                break;

            case AimDirection.AimAtPosition:
                AimingAtPosition aimingPosition = new AimingAtPosition(charShooter);
                aimingPosition.Setup(this.target);
                charShooter.StartAiming(aimingPosition);
                break;

            case AimDirection.AimMuzzleForward:
                AimingMuzzleForward aimingForward = new AimingMuzzleForward(charShooter);
                charShooter.StartAiming(aimingForward);
                break;

            case AimDirection.AimTopDownPlane:
                AimingGroundPlane aimingGround = new AimingGroundPlane(charShooter);
                charShooter.StartAiming(aimingGround);
                break;

            case AimDirection.AimTopDownFloor:
                AimingGroundFloor aimingFloor = new AimingGroundFloor(charShooter);
                charShooter.StartAiming(aimingFloor);
                break;

            case AimDirection.AimSideScroll:
                AimingSideScrollPlane aimingSidescroll = new AimingSideScrollPlane(charShooter);
                aimingSidescroll.Setup(this.axis);
                charShooter.StartAiming(aimingSidescroll);
                break;
            }

            return(true);
        }