Example #1
0
    public override void Setup(FlightCourse fc, Drone playerDrone)
    {
        base.Setup(fc, playerDrone);

        _drone = playerDrone;
        //transform.SetParent(playerDrone.transform);

        // CalculateTarget
        SetTarget();

        // Snap to target
        transform.position = _targetPosition;
        transform.rotation = _targetRotation;
    }
Example #2
0
 public void SetFlightCourse(FlightCourse fc)
 {
     _flightCourse = fc;
 }
Example #3
0
    static void ValidateLootTables(FlightCourse[] flightCourses)
    {
        Dictionary<int, LootTable> lootTables = new Dictionary<int, LootTable>();
        foreach (FlightCourse fc in flightCourses)
        {
            // Validate the loot table
            if (fc.LootTable == null)
            {
                string err = string.Format("Flight Course ({0}) has no loot table", fc.gameObject.name);
                Debug.Log(err);
                throw new Exception(err);
            }
            else if (lootTables.ContainsKey(fc.LootTable.TableID))
            {
                string err = string.Format("Duplicate loot table ID found ({0}): {1} - {2}", fc.LootTable.TableID, fc.LootTable.gameObject.name, lootTables[fc.LootTable.TableID].gameObject.name);
                Debug.Log(err);
                throw new Exception(err);
            }
            else
            {
                lootTables[fc.LootTable.TableID] = fc.LootTable;
                if (fc.LootTable.MarkerBonus + fc.LootTable.BaseDropChance > 100)
                {
                    throw new Exception(string.Format("LootTable ({0}:{1}) BaseDropChance + MarkerBonus exceeds 100%", fc.LootTable.TableID, fc.LootTable.gameObject.name));
                }

                if (fc.LootTable.Ranges.Length <= 0)
                {
                    string err = string.Format("LootTable ({0}:{1}) has no ranges", fc.LootTable.TableID, fc.LootTable.gameObject.name);
                    Debug.Log(err);
                    throw new Exception(err);
                }
                else
                {
                    float totalPercentage = 0;
                    foreach (LootRange range in fc.LootTable.Ranges)
                    {
                        totalPercentage += range.Percentage;
                    }
                    if (totalPercentage > 100)
                    {
                        string err = string.Format("LootTable ({0}:{1}) ranges add up to more than 100%", fc.LootTable.TableID, fc.LootTable.gameObject.name);
                        Debug.Log(err);
                        throw new Exception(err);
                    }
                }
            }
        }
    }
Example #4
0
 public virtual void Setup(FlightCourse fc, Drone playerDrone)
 {
 }