Esempio n. 1
0
 // Token: 0x0600020D RID: 525 RVA: 0x0001011C File Offset: 0x0000E31C
 private void OnUnitAdded(Unit9 unit)
 {
     try
     {
         if (unit.IsLaneCreep && unit.Team != this.ownerTeam)
         {
             if (!unit.BaseUnit.IsSpawned && unit.BaseUnit.IsAlive)
             {
                 LanePosition lane = this.lanePaths.GetCreepLane(unit);
                 if (lane != LanePosition.Unknown)
                 {
                     CreepWave creepWave = this.creepWaves.SingleOrDefault((CreepWave x) => !x.IsSpawned && x.Lane == lane);
                     if (creepWave == null)
                     {
                         this.creepWaves.Add(creepWave = new CreepWave(lane, this.lanePaths.GetLanePath(lane)));
                     }
                     creepWave.Creeps.Add(unit);
                 }
             }
         }
     }
     catch (Exception exception)
     {
         Logger.Error(exception, null);
     }
 }
    private CharacterBattle GetNextCharacterBattle(LanePosition lanePosition, bool moveUp, bool isPlayerTeam)
    {
        List <CharacterBattle> characterBattleList = GetAliveTeamCharacterBattleList(isPlayerTeam);

        if (characterBattleList.Count == 0)
        {
            return(null);
        }

        CharacterBattle characterBattle = null;

        do
        {
            // Get next lane position
            lanePosition = GetNextLanePosition(lanePosition, moveUp);
            // Find character at that position
            characterBattle = GetCharacterBattleAt(lanePosition, isPlayerTeam);
            if (characterBattle != null && characterBattle.IsDead())
            {
                characterBattle = null;                                                      // Ignore dead
            }
        } while (characterBattle == null);

        return(characterBattle);
    }
Esempio n. 3
0
    private void GetObstacleFromPool(LanePosition lanePosition, ObstacleType obstacleType)
    {
        GameObject obstacle = ObstaclePoolController.Instance.RequestObstacle(obstacleType);

        obstacle.GetComponent <Obstacle>().SetSpeed(speedAmountToAdd);
        obstacle.transform.position = laneSpawners[(int)lanePosition].transform.position;
    }
Esempio n. 4
0
        public float GetActiveTreeDistance(NetInfo prefab, LanePosition position)
        {
            var segmentData = SegmentDataManager.Instance.GetActiveOptions(prefab);

            var result = 0f;

            if (segmentData != null && segmentData.Features.IsFlagSet(SegmentData.FeatureFlags.RepeatDistances))
            {
                switch (position)
                {
                case LanePosition.Left:
                    result = segmentData.RepeatDistances.x;
                    break;

                case LanePosition.Middle:
                    result = segmentData.RepeatDistances.y;
                    break;

                case LanePosition.Right:
                    result = segmentData.RepeatDistances.z;
                    break;

                default:
                    throw new ArgumentOutOfRangeException(nameof(position));
                }
            }

            return(result > 0f ? result : GetDefaultTreeDistance(prefab, position));
        }
Esempio n. 5
0
 private void CanceledLaneSwitch()
 {
     if (directionBetweenLanes == ChangingDirection.Left)
     {
         if (lane == LanePosition.Left)
         {
             lane = LanePosition.Mid;
         }
         else
         {
             lane = LanePosition.Right;
         }
     }
     else
     {
         if (lane == LanePosition.Right)
         {
             lane = LanePosition.Mid;
         }
         else
         {
             lane = LanePosition.Left;
         }
     }
 }
Esempio n. 6
0
    private void MoveRight()
    {
        if (inMove)
        {
            return;
        }
        if (lane == LanePosition.Right)
        {
            return;
        }
        if (lane == LanePosition.Mid)
        {
            lane = LanePosition.Right;
        }
        else
        {
            lane = LanePosition.Mid;
        }
        directionBetweenLanes = ChangingDirection.Right;
        aimPositionX         += distanceBetweenLanes;

        StartMovement();

        animator.SetBool(leftMoveAnimation, true);
        lastAnimation = leftMoveAnimation;
    }
Esempio n. 7
0
        public float GetActiveTreeDistance(NetInfo prefab, LanePosition position)
        {
            var segmentData = SegmentDataManager.Instance.GetActiveOptions(prefab);

            var result = 0f;
            if (segmentData != null && segmentData.Features.IsFlagSet(SegmentData.FeatureFlags.RepeatDistances))
            {
                switch (position)
                {
                    case LanePosition.Left:
                        result = segmentData.RepeatDistances.x;
                        break;
                    case LanePosition.Middle:
                        result = segmentData.RepeatDistances.y;
                        break;
                    case LanePosition.Right:
                        result = segmentData.RepeatDistances.z;
                        break;
                    default:
                        throw new ArgumentOutOfRangeException(nameof(position));
                }
            }

            return result > 0f ? result : GetDefaultTreeDistance(prefab, position);
        }
    public static LanePosition GetNextLanePosition(LanePosition lanePosition, bool moveUp)
    {
        if (moveUp)
        {
            switch (lanePosition)
            {
            default:
            case LanePosition.Middle: return(LanePosition.Up);

            case LanePosition.Up: return(LanePosition.Top);

            case LanePosition.Top: return(LanePosition.Bottom);

            case LanePosition.Bottom: return(LanePosition.Down);

            case LanePosition.Down: return(LanePosition.Middle);
            }
        }
        else
        {
            switch (lanePosition)
            {
            default:
            case LanePosition.Middle: return(LanePosition.Down);

            case LanePosition.Down: return(LanePosition.Bottom);

            case LanePosition.Bottom: return(LanePosition.Top);

            case LanePosition.Top: return(LanePosition.Up);

            case LanePosition.Up: return(LanePosition.Middle);
            }
        }
    }
Esempio n. 9
0
 // Token: 0x060001EE RID: 494 RVA: 0x0000F954 File Offset: 0x0000DB54
 public CreepWave(LanePosition lane, Vector3[] path)
 {
     this.Lane              = lane;
     this.Path              = path;
     this.pathLength        = this.Path.Length;
     this.endPosition       = path[this.pathLength - 1];
     this.predictedPosition = path[0];
 }
Esempio n. 10
0
        private void InitNoteMesh(int noteTextureId, LanePosition position, float verticalOffset)
        {
            float uvStart  = (float)noteTextureId / NoteTextureCount;
            float uvEnd    = (float)(noteTextureId + 1) / NoteTextureCount;
            var   noteMesh = Instantiate(NoteMeshPrefab);                                       //new generic note mesh

            noteMesh.transform.parent        = transform;                                       //parent to us
            noteMesh.transform.localPosition = new Vector3(position.Center, 0, verticalOffset); //offset from us
            noteMesh.GetComponent <NoteMeshSetup>().Init(position.Width, uvStart, uvEnd);       //generate mesh
        }
 private CharacterBattle GetCharacterBattleAt(LanePosition lanePosition, bool isPlayerTeam)
 {
     foreach (CharacterBattle characterBattle in characterBattleList)
     {
         if (characterBattle.IsPlayerTeam() == isPlayerTeam && characterBattle.GetLanePosition() == lanePosition)
         {
             return(characterBattle);
         }
     }
     return(null);
 }
Esempio n. 12
0
        public static bool IsCorrectSide(this LanePosition position, float lanePosition)
        {
            switch (position)
            {
            case LanePosition.Left: return(lanePosition < 0f);

            case LanePosition.Middle: return(Mathf.Approximately(lanePosition, 0f));

            case LanePosition.Right: return(lanePosition > 0f);

            default: throw new ArgumentOutOfRangeException(nameof(position), position, null);
            }
        }
Esempio n. 13
0
        public static SegmentData.FeatureFlags ToTreeFeatureFlag(this LanePosition position)
        {
            switch (position)
            {
            case LanePosition.Left: return(SegmentData.FeatureFlags.TreeLeft);

            case LanePosition.Middle: return(SegmentData.FeatureFlags.TreeMiddle);

            case LanePosition.Right: return(SegmentData.FeatureFlags.TreeRight);

            default: throw new ArgumentOutOfRangeException(nameof(position), position, null);
            }
        }
Esempio n. 14
0
        public static string GetDescription(this LanePosition position)
        {
            switch (position)
            {
            case LanePosition.Left: return("Left");

            case LanePosition.Middle: return("Middle");

            case LanePosition.Right: return("Right");

            default: throw new ArgumentOutOfRangeException(nameof(position), position, null);
            }
        }
Esempio n. 15
0
    public void Start(CameraFollow cameraFollow)
    {
        this.cameraFollow = cameraFollow;
        cameraFollow.Setup(() => Vector3.zero, () => 50f, true, true);
        cameraFollow.SetCameraMoveSpeed(10f);
        cameraFollow.SetCameraZoomSpeed(10f);
        ResetCamera();

        // Set up Battle Scene
        foreach (Character character in GameData.characterList)
        {
            if (character.isInPlayerTeam)
            {
                LanePosition lanePosition;
                switch (character.type)
                {
                default:
                case Character.Type.Player:
                    lanePosition = LanePosition.Middle;
                    break;

                case Character.Type.Tank:
                    lanePosition = LanePosition.Down;
                    break;

                case Character.Type.Healer:
                    lanePosition = LanePosition.Up;
                    break;
                }

                SpawnCharacter(character.type, lanePosition, true, character.stats);
            }
        }

        GameData.EnemyEncounter enemyEncounter = BattleHandler.enemyEncounter;
        for (int i = 0; i < enemyEncounter.enemyBattleArray.Length; i++)
        {
            GameData.EnemyEncounter.EnemyBattle enemyBattle = enemyEncounter.enemyBattleArray[i];
            SpawnCharacter(enemyBattle.characterType, enemyBattle.lanePosition, false,
                           new Character(enemyBattle.characterType).stats);
        }

        SetActiveCharacterBattle(GetAliveTeamCharacterBattleList(true)[0]);
        SetSelectedTargetCharacterBattle(GetAliveTeamCharacterBattleList(false)[0]);

        lastPlayerActiveLanePosition = GetAliveTeamCharacterBattleList(true)[0].GetLanePosition();
        lastEnemyActiveLanePosition  =
            GetNextLanePosition(GetAliveTeamCharacterBattleList(false)[0].GetLanePosition(), true);

        state = State.WaitingForPlayer;
    }
Esempio n. 16
0
        public void SetTree(NetInfo prefab, LanePosition position, TreeInfo tree)
        {
            var newSegmentData = new SegmentData(SegmentDataManager.Instance.GetActiveOptions(prefab));

            if (tree != GetDefaultTree(prefab, position))
            {
                newSegmentData.SetPrefabFeature(position.ToTreeFeatureFlag(), tree);
            }
            else
            {
                newSegmentData.UnsetFeature(position.ToTreeFeatureFlag());
            }

            SegmentDataManager.Instance.SetActiveOptions(prefab, newSegmentData);
        }
Esempio n. 17
0
        public static float GetLaneDelay(LanePosition lane, Team team)
        {
            switch (lane)
            {
            case LanePosition.Easy:
                return(team == Team.Radiant ? 0.3f : 0.5f);

            case LanePosition.Middle:
                return(team == Team.Radiant ? 0.5f : 0.4f);

            case LanePosition.Hard:
                return(team == Team.Radiant ? 0.1f : 0.7f);

            default:
                return(0);
            }
        }
Esempio n. 18
0
    public static Vector3 GetPosition(LanePosition lanePosition, bool isPlayerTeam)
    {
        float playerTeamMultiplier = isPlayerTeam ? -1f : 1f;

        switch (lanePosition)
        {
        default:
        case LanePosition.Middle: return(new Vector3(playerTeamMultiplier * 50f, 0));

        case LanePosition.Up: return(new Vector3(playerTeamMultiplier * 60f, +20));

        case LanePosition.Down: return(new Vector3(playerTeamMultiplier * 60f, -20));

        case LanePosition.Top: return(new Vector3(playerTeamMultiplier * 70f, +35));

        case LanePosition.Bottom: return(new Vector3(playerTeamMultiplier * 70f, -35));
        }
    }
Esempio n. 19
0
        public TreeInfo GetActiveTree(NetInfo prefab, LanePosition position)
        {
            var segmentData = SegmentDataManager.Instance.GetActiveOptions(prefab);

            if (segmentData == null || !segmentData.Features.IsFlagSet(position.ToTreeFeatureFlag()))
            {
                return GetDefaultTree(prefab, position);
            }
            else
            {
                switch (position)
                {
                    case LanePosition.Left: return segmentData.TreeLeftPrefab;
                    case LanePosition.Middle: return segmentData.TreeMiddlePrefab;
                    case LanePosition.Right: return segmentData.TreeRightPrefab;
                    default: throw new ArgumentOutOfRangeException(nameof(position));
                }
            }
        }
Esempio n. 20
0
        private static void ProcessChannelNotes(Match match, int barOffset, BpmGraph barToBeat, BpmGraph bpmGraph,
                                                Dictionary <int, List <PartialData> > channelData)
        {
            int barNum  = ParseMmm(match.Groups[1]) + barOffset;
            int lane    = ParseXY(match.Groups[2]);
            int channel = ParseXY(match.Groups[3]);

            ProcessNotes(match.Groups[4], (barOff, type, width) =>
            {
                double beat = barToBeat.BeatAt(barNum + barOff);
                var time    = bpmGraph.FromBeat(beat);
                var pos     = new LanePosition(lane * 2, width * 2);
                if (!channelData.ContainsKey(channel))
                {
                    channelData.Add(channel, new List <PartialData>());
                }
                channelData[channel].Add(new PartialData(type, pos, time));
            });
        }
Esempio n. 21
0
        public TreeInfo GetActiveTree(NetInfo prefab, LanePosition position)
        {
            var segmentData = SegmentDataManager.Instance.GetActiveOptions(prefab);

            if (segmentData == null || !segmentData.Features.IsFlagSet(position.ToTreeFeatureFlag()))
            {
                return(GetDefaultTree(prefab, position));
            }
            else
            {
                switch (position)
                {
                case LanePosition.Left: return(segmentData.TreeLeftPrefab);

                case LanePosition.Middle: return(segmentData.TreeMiddlePrefab);

                case LanePosition.Right: return(segmentData.TreeRightPrefab);

                default: throw new ArgumentOutOfRangeException(nameof(position));
                }
            }
        }
Esempio n. 22
0
        public bool HasTrees(NetInfo prefab, LanePosition position)
        {
            if (prefab.m_lanes == null)
            {
                return(false);
            }

            foreach (var lane in prefab.m_lanes)
            {
                if (lane?.m_laneProps?.m_props != null && position.IsCorrectSide(lane.m_position))
                {
                    foreach (var laneProp in lane.m_laneProps.m_props)
                    {
                        if (laneProp?.m_finalTree != null && _availableStreetLights.Contains(laneProp.m_finalProp))
                        {
                            return(true);
                        }
                    }
                }
            }
            return(false);
        }
Esempio n. 23
0
        public float GetDefaultTreeDistance(NetInfo prefab, LanePosition position)
        {
            if (prefab.m_lanes == null)
            {
                return(-1f);
            }

            foreach (var lane in prefab.m_lanes)
            {
                if (lane?.m_laneProps?.m_props != null && position.IsCorrectSide(lane.m_position))
                {
                    foreach (var laneProp in lane.m_laneProps.m_props)
                    {
                        if (laneProp?.m_finalTree != null)
                        {
                            return(laneProp.m_repeatDistance);
                        }
                    }
                }
            }

            return(-1f);
        }
Esempio n. 24
0
        public TreeInfo GetDefaultTree(NetInfo prefab, LanePosition position)
        {
            if (prefab.m_lanes == null)
            {
                return(null);
            }

            foreach (var lane in prefab.m_lanes)
            {
                if (lane?.m_laneProps?.m_props != null && position.IsCorrectSide(lane.m_position))
                {
                    foreach (var laneProp in lane.m_laneProps.m_props)
                    {
                        if (laneProp?.m_finalTree != null)
                        {
                            return(laneProp.m_finalTree);
                        }
                    }
                }
            }

            return(null);
        }
Esempio n. 25
0
        public void SetTreeDistance(NetInfo prefab, LanePosition position, float val)
        {
            var newSegmentData = new SegmentData(SegmentDataManager.Instance.GetActiveOptions(prefab));

            var distanceVector = newSegmentData.RepeatDistances;
            var value          = Mathf.Abs(val - GetDefaultTreeDistance(prefab, position)) > .01f ? val : 0f;

            switch (position)
            {
            case LanePosition.Left:
                distanceVector.x = value;
                break;

            case LanePosition.Middle:
                distanceVector.y = value;
                break;

            case LanePosition.Right:
                distanceVector.z = value;
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(position));
            }

            if (distanceVector != Vector4.zero)
            {
                newSegmentData.SetStructFeature(SegmentData.FeatureFlags.RepeatDistances, distanceVector);
            }
            else
            {
                newSegmentData.UnsetFeature(SegmentData.FeatureFlags.RepeatDistances);
            }

            SegmentDataManager.Instance.SetActiveOptions(prefab, newSegmentData);
        }
Esempio n. 26
0
        public void SetTreeDistance(NetInfo prefab, LanePosition position, float val)
        {
            var newSegmentData = new SegmentData(SegmentDataManager.Instance.GetActiveOptions(prefab));

            var distanceVector = newSegmentData.RepeatDistances;
            var value = Mathf.Abs(val - GetDefaultTreeDistance(prefab, position)) > .01f ? val : 0f;

            switch (position)
            {
                case LanePosition.Left:
                    distanceVector.x = value;
                    break;
                case LanePosition.Middle:
                    distanceVector.y = value;
                    break;
                case LanePosition.Right:
                    distanceVector.z = value;
                    break;
                default:
                    throw new ArgumentOutOfRangeException(nameof(position));
            }

            if (distanceVector != Vector4.zero)
            {
                newSegmentData.SetStructFeature(SegmentData.FeatureFlags.RepeatDistances, distanceVector);
            }
            else
            {
                newSegmentData.UnsetFeature(SegmentData.FeatureFlags.RepeatDistances);
            }

            SegmentDataManager.Instance.SetActiveOptions(prefab, newSegmentData);
        }
Esempio n. 27
0
 public static float GetDefaultRepeatDistance(NetInfo prefab, LanePosition position)
 {
     return(NetUtils.GetMatchingLaneProp(prefab, laneProp => laneProp.m_finalTree != null, position)?.m_repeatDistance ?? 20f);
 }
Esempio n. 28
0
 public TreePanelController(LanePosition position)
 {
     Position = position;
 }
Esempio n. 29
0
        public bool HasTrees(NetInfo prefab, LanePosition position)
        {
            if (prefab.m_lanes == null) return false;

            foreach (var lane in prefab.m_lanes)
                if (lane?.m_laneProps?.m_props != null && position.IsCorrectSide(lane.m_position))
                    foreach (var laneProp in lane.m_laneProps.m_props)
                    {
                        if (laneProp?.m_finalTree != null && _availableStreetLights.Contains(laneProp.m_finalProp)) return true;
                    }
            return false;
        }
Esempio n. 30
0
        public TreeInfo GetDefaultTree(NetInfo prefab, LanePosition position)
        {
            if (prefab.m_lanes == null) return null;

            foreach (var lane in prefab.m_lanes)
                if (lane?.m_laneProps?.m_props != null && position.IsCorrectSide(lane.m_position))
                    foreach (var laneProp in lane.m_laneProps.m_props)
                    {
                        if (laneProp?.m_finalTree != null) return laneProp.m_finalTree;
                    }

            return null;
        }
Esempio n. 31
0
        public float GetDefaultTreeDistance(NetInfo prefab, LanePosition position)
        {
            if (prefab.m_lanes == null) return -1f;

            foreach (var lane in prefab.m_lanes)
                if (lane?.m_laneProps?.m_props != null && position.IsCorrectSide(lane.m_position))
                    foreach (var laneProp in lane.m_laneProps.m_props)
                    {
                        if (laneProp?.m_finalTree != null) return laneProp.m_repeatDistance;
                    }

            return -1f;
        }
Esempio n. 32
0
 public Vector3[] GetLanePath(LanePosition lane)
 {
     return(this.Lanes[lane]);
 }
Esempio n. 33
0
 public AirArrow(NoteTime time, LanePosition position, bool isUp, int arrowShift) : base(time, position)
 {
     IsUp       = isUp;
     ArrowShift = arrowShift;
 }
Esempio n. 34
0
 public static TreeInfo GetDefaultTree(NetInfo prefab, LanePosition position)
 {
     return(NetUtils.GetMatchingLaneProp(prefab, laneProp => laneProp.m_finalTree != null, position)?.m_finalTree);
 }
Esempio n. 35
0
 public TreeModifier(LanePosition position, TreeInfo tree = null, float repeatDistance = 20) : base(NetworkSkinModifierType.Tree)
 {
     Position       = position;
     Tree           = tree;
     RepeatDistance = repeatDistance;
 }
Esempio n. 36
0
 public HeldNote(NoteTime time, LanePosition position, SlidePoint[] slidePoints) : base(time, position)
 {
     SlidePoints = slidePoints;
 }
Esempio n. 37
0
        public void SetTree(NetInfo prefab, LanePosition position, TreeInfo tree)
        {
            var newSegmentData = new SegmentData(SegmentDataManager.Instance.GetActiveOptions(prefab));

            if (tree != GetDefaultTree(prefab, position))
            {
                newSegmentData.SetPrefabFeature(position.ToTreeFeatureFlag(), tree);
            }
            else
            {
                newSegmentData.UnsetFeature(position.ToTreeFeatureFlag());
            }

            SegmentDataManager.Instance.SetActiveOptions(prefab, newSegmentData);
        }