private async Task <bool> StateCoroutine_CompletingObjectives()
        {
            // If for some reason no longer in the vehicle, go fetch another...
            if (!IsInBalloon())
            {
                QBCLog.Warning("We've been jettisoned from vehicle unexpectedly--will try again.");
                BehaviorState = BehaviorStateType.MountingVehicle;
                return(true);
            }

            // If quest is complete, then head back...
            if (Me.IsQuestComplete(GetQuestId()))
            {
                BehaviorState = BehaviorStateType.ReturningToBase;
                return(true);
            }

            await(_updateUser_CompletingObjectives ?? (_updateUser_CompletingObjectives =
                                                           new ThrottleCoroutineTask(
                                                               Throttle.UserUpdate,
                                                               async() => TreeRoot.StatusText = "Completing Quest Objectives")));

            // Select new best target, if our current one is no longer useful...
            if (!IsViableForTargeting(SelectedTarget))
            {
                var questId = GetQuestId();
                if (!IsViableForTargeting(SelectedTarget) && !Me.IsQuestObjectiveComplete(questId, 1))
                {
                    SelectedTarget = FindBestTarget(MobId_Objective1_SteamwheedleSurvivor);
                    WeaponChoice   = WeaponLifeRocket;
                }

                if (!IsViableForTargeting(SelectedTarget) && !Me.IsQuestObjectiveComplete(questId, 2))
                {
                    SelectedTarget = FindBestTarget(MobId_Objective2_SouthseaBlockader);
                    WeaponChoice   = WeaponPirateDestroyingBomb;
                }
            }
            // Aim & Fire at the selected target...
            else
            {
                // If weapon aim cannot address selected target, blacklist target for a few seconds...
                if (!WeaponChoice.WeaponAim(SelectedTarget))
                {
                    _targetBlacklist.Add(SelectedTarget, TimeSpan.FromSeconds(5));
                    return(false);
                }

                // If weapon could not be fired, wait for it to become ready...
                if (!WeaponChoice.WeaponFire())
                {
                    return(false);
                }

                // Weapon was fired, blacklist target so we can choose another...
                _targetBlacklist.Add(SelectedTarget, TimeSpan.FromSeconds(15));
                await Coroutine.Sleep((int)Delay.AfterWeaponFire.TotalMilliseconds);
            }
            return(true);
        }
コード例 #2
0
    private void Awake()
    {
        weaponManager = GetComponent <WeaponChoice>();

        crosshair = GameObject.FindWithTag(Tags.crosshair);

        mainCam = Camera.main;
    }
コード例 #3
0
 public IPlayer CreatePlayer(PlayerState state       = PlayerState.Default, WeaponChoice weapon = WeaponChoice.Torpedo, ConsoleColor color = ConsoleColor.Cyan,
                             Position playerPosition = null, int lives = 3, int health = 10, int score = 0)
 {
     if (playerPosition == null)
     {
         playerPosition = new Position((Console.WindowWidth - 4) / 2, Console.WindowHeight - 1);
     }
     return(new Player(state, weapon, color, playerPosition, lives, health, score));
 }
コード例 #4
0
        //public Player() : this(PlayerState.Default, WeaponChoice.Torpedo, ConsoleColor.Cyan, new Position((Console.WindowWidth - 4) / 2, Console.WindowHeight - 1), 3, 30, 0)
        //{
        //}

        public Player(PlayerState state, WeaponChoice weapon, ConsoleColor color, Position playerPosition, int lives, int health, int score)
        {
            this.State          = state;
            this.Weapon         = weapon;
            this.Color          = color;
            this.ObjectPosition = playerPosition;
            this.ShootedBullets = new List <IBullet>();
            this.Lives          = lives;
            this.Health         = health;
            this.Score          = score;
        }
コード例 #5
0
        public Player(PlayerState state, WeaponChoice weapon, ConsoleColor color, Position playerPosition, int lives, int health, int score, int booletsLeft)
        {
            this.State          = state;
            this.Weapon         = weapon;
            this.Color          = color;
            this.PlayerPosition = playerPosition;

            this.Lives       = lives;
            this.Health      = health;
            this.Score       = score;
            this.booletsLeft = booletsLeft;
        }
コード例 #6
0
 WeaponType getWeaponType(WeaponChoice weapon)
 {
     if (weapon == WeaponChoice.Sniper)
     {
         return(WeaponType.Laser);
     }
     else if (weapon == WeaponChoice.Shotgun)
     {
         return(WeaponType.Shotgun);
     }
     return(WeaponType.Laser);
 }
コード例 #7
0
 void enableWeapon(WeaponChoice weapon)
 {
     if (weapon == WeaponChoice.Sniper)
     {
         _Gun = transform.Find("Sniper").gameObject;
         transform.Find("Shotgun").gameObject.SetActive(false);
     }
     else if (weapon == WeaponChoice.Shotgun)
     {
         _Gun = transform.Find("Shotgun").gameObject;
         transform.Find("Sniper").gameObject.SetActive(false);
     }
     _Gun.SetActive(true);
     //_Gun.transform.Rotate(0.0f, Random.Range(-180.0f, 180.0f), 0.0f);
 }
コード例 #8
0
ファイル: WeaponChoice.cs プロジェクト: Nicholas56/Threshold
 private void Awake()
 {
     current = this;
 }
コード例 #9
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown (KeyCode.Alpha1)) {
            iconLocation.sprite = iceIcon;
            weaponChoice = WeaponChoice.Ice;
        }
        else if (Input.GetKeyDown (KeyCode.Alpha2)) {
            iconLocation.sprite = fireIcon;
            weaponChoice = WeaponChoice.Fire;
        }
        else if (Input.GetKeyDown (KeyCode.Alpha3)) {
            iconLocation.sprite = lightningIcon;
            weaponChoice = WeaponChoice.Lightning;
        }

        if (Input.GetMouseButtonDown(0))
        {
            FireWeapon();
        }
    }