Пример #1
0
        public static void TryToPlayResourceGatheringSfx(Vector3 soundOrigin, Screens.ResourceType resourceType)
        {
            SoundEffect soundEffect = null;

            switch (resourceType)
            {
            case Screens.ResourceType.Gold:
                soundEffect = GetRandomSoundEffect(UnitMineGold);
                SoundEffectTracker.TryPlayCameraRestrictedSoundEffect(soundEffect, UnitMineGold, Camera.Main.Position, soundOrigin);
                break;

            case Screens.ResourceType.Lumber:
                soundEffect = GetRandomSoundEffect(UnitWoodChop);
                SoundEffectTracker.TryPlayCameraRestrictedSoundEffect(soundEffect, UnitWoodChop, Camera.Main.Position, soundOrigin);
                break;

            case Screens.ResourceType.Stone:
                //ToDo: Rick - Uncomment when stone is implemented.
                soundEffect = GetRandomSoundEffect(UnitMineStone);
                SoundEffectTracker.TryPlayCameraRestrictedSoundEffect(soundEffect, UnitMineStone, Camera.Main.Position, soundOrigin);
                break;
            }
        }
Пример #2
0
        public void AssignResourceCollectGoal(Vector3 clickPosition, AxisAlignedRectangle resourceGroupTile, Screens.ResourceType resourceType)
        {
            var collectResourceGoal = new ResourceCollectHighLevelGoal(
                owner: this,
                nodeNetwork: NodeNetwork,
                clickPosition: clickPosition,
                targetResourceMergedTile: resourceGroupTile,
                targetResourceType: resourceType,
                allBuildings: AllBuildings
                );

            if (ImmediateGoal?.Path != null)
            {
                ImmediateGoal.Path.Clear();
            }
            HighLevelGoals.Clear();
            HighLevelGoals.Push(collectResourceGoal);
        }
Пример #3
0
        /// <summary>
        /// Unit has a resource to return, but we don't have enough to restart a full resource collection goal (e.g., harvested item, then cancelled -> no prior resource destination available).
        /// </summary>
        public void AssignResourceReturnGoal(Vector3 clickPosition, Building targetReturnBuilding, Screens.ResourceType resourceType)
        {
            var returnResourceGoal = new ResourceReturnHighLevelGoal(
                owner: this,
                nodeNetwork: NodeNetwork,
                targetReturnBuilding: targetReturnBuilding
                );

            if (ImmediateGoal?.Path != null)
            {
                ImmediateGoal.Path.Clear();
            }
            HighLevelGoals.Clear();
            HighLevelGoals.Push(returnResourceGoal);
        }