Exemplo n.º 1
0
 public SoldierSpawnerCollision(int targetSoldierCost, GameObject targetSoldier, Vector3 targetSpawnDirection, Material targetMaterial, GameResources.Allegiance targetAllegience)
 {
     soldierCost    = targetSoldierCost;
     soldier        = targetSoldier;
     spawnDirection = targetSpawnDirection;
     myMaterial     = targetMaterial;
     allegiance     = targetAllegience;
 }
Exemplo n.º 2
0
 public SpawnerCollision(int targetWorkerCost, GameObject targetWorker, GameObject targetCollectionZone, Vector3 targetSpawnDirection, Material targetMaterial, GameResources.Allegiance targetAllegience)
 {
     workerCost     = targetWorkerCost;
     worker         = targetWorker;
     collectionZone = targetCollectionZone;
     spawnDirection = targetSpawnDirection;
     myMaterial     = targetMaterial;
     allegiance     = targetAllegience;
 }
Exemplo n.º 3
0
 public void SoldierSpawnerCollision_Rebuild(int targetSoldierCost, GameObject targetSoldier, Vector3 targetSpawnDirection, Material targetMaterial, Quaternion targetDirection, GameResources.Allegiance targetAllegience)
 {
     soldierCost    = targetSoldierCost;
     soldier        = targetSoldier;
     spawnDirection = targetSpawnDirection;
     myMaterial     = targetMaterial;
     allegiance     = targetAllegience;
     direction      = targetDirection;
 }
Exemplo n.º 4
0
    public static bool IsAvailablePickUp(GameObject PickUp, GameResources.Allegiance allegiance)
    {
        return(openPickUpDictionary[allegiance].ContainsKey(PickUp));

        /*
         * if (openPickUpDictionary[allegiance].ContainsKey(PickUp))
         * {
         *  return true;
         * }
         * return false;
         */
    }
Exemplo n.º 5
0
 public static void CarryPickUp(GameObject PickUp, GameObject Worker, GameResources.Allegiance allegiance)
 {
     foreach (GameResources.Allegiance item in Enum.GetValues(typeof(GameResources.Allegiance)))
     {
         if (openPickUpDictionary[item][PickUp] != null)
         {
             openPickUpDictionary[item][PickUp].GetComponent <Worker>().ClearTarget();
         }
         openPickUpDictionary[item].Remove(PickUp);
         //targetedPickUpDictionary[item].Remove(PickUp);
     }
     carriedPickUpDictionary[allegiance].Add(PickUp, Worker);
 }
Exemplo n.º 6
0
    public static GameObject GiveMeSoldierSpawner(Vector3 targetPosition, Quaternion targetRotation, GameResources.Allegiance allegiance, Vector3 spawnDirection)
    {
        GameObject instance = Instantiate <GameObject>(SoldierSpawner, targetPosition, targetRotation);

        instance.GetComponent <SoldierSpawner>().Soldier        = SoldierTemplate;
        instance.GetComponent <SoldierSpawner>().SoldierCost    = SoldierCost;
        instance.GetComponent <SoldierSpawner>().SpawnDirection = spawnDirection;
        instance.GetComponent <SoldierSpawner>().Allegiance     = allegiance;
        switch (allegiance)
        {
        case GameResources.Allegiance.Team1:
            instance.GetComponent <Renderer>().material = Team1Material;
            break;

        case GameResources.Allegiance.Team2:
            instance.GetComponent <Renderer>().material = Team2Material;
            break;

        default:
            instance.GetComponent <Renderer>().material = DefaultMaterial;
            break;
        }
        return(instance);
    }
Exemplo n.º 7
0
    public static GameObject GiveMeWorker(Vector3 targetPosition, Quaternion targetRotation, GameResources.Allegiance allegiance, GameObject collectionZone)
    {
        GameObject instance = Instantiate <GameObject>(WorkerTemplate, targetPosition, targetRotation);

        instance.GetComponent <Worker>().HomeZone   = collectionZone;
        instance.GetComponent <Worker>().allegiance = allegiance;
        switch (allegiance)
        {
        case GameResources.Allegiance.Team1:
            instance.GetComponent <Renderer>().material = Team1Material;
            break;

        case GameResources.Allegiance.Team2:
            instance.GetComponent <Renderer>().material = Team2Material;
            break;

        default:
            instance.GetComponent <Renderer>().material = DefaultMaterial;
            break;
        }
        return(instance);
    }
Exemplo n.º 8
0
 public void SetAllegiance(GameResources.Allegiance newAllegiance)
 {
     allegiance = newAllegiance;
 }
Exemplo n.º 9
0
 // At the start of the game..
 void Start()
 {
     // Assign the Rigidbody component to our private rb variable
     rb         = GetComponent <Rigidbody>();
     allegiance = GameResources.Allegiance.Team1;
 }
Exemplo n.º 10
0
    public static GameObject GiveMeSoldier(Vector3 targetPosition, Quaternion targetRotation, GameResources.Allegiance allegiance, GameObject target)
    {
        GameObject instance = Instantiate <GameObject>(SoldierTemplate, targetPosition + new Vector3(Random.Range(-2f, 2f), 0, 0), targetRotation);

        instance.GetComponent <Soldier>().allegiance = allegiance;
        instance.GetComponent <Soldier>().aimTarget  = target;
        switch (allegiance)
        {
        case GameResources.Allegiance.Team1:
            instance.GetComponent <Renderer>().material = Team1Material;
            instance.transform.GetChild(0).GetComponent <Renderer>().material             = Team1Material;
            instance.transform.GetChild(0).GetChild(0).GetComponent <Renderer>().material = Team1Material;
            break;

        case GameResources.Allegiance.Team2:
            instance.GetComponent <Renderer>().material = Team2Material;
            instance.transform.GetChild(0).GetComponent <Renderer>().material             = Team2Material;
            instance.transform.GetChild(0).GetChild(0).GetComponent <Renderer>().material = Team2Material;
            break;

        default:
            instance.GetComponent <Renderer>().material = DefaultMaterial;
            instance.transform.GetChild(0).GetComponent <Renderer>().material             = DefaultMaterial;
            instance.transform.GetChild(0).GetChild(0).GetComponent <Renderer>().material = DefaultMaterial;
            break;
        }
        return(instance);
    }
Exemplo n.º 11
0
 public static void DeliverPickUp(GameObject PickUp, GameResources.Allegiance allegiance)
 {
     carriedPickUpDictionary[allegiance].Remove(PickUp);
 }
Exemplo n.º 12
0
 public static void UntargetPickUp(GameObject PickUp, GameResources.Allegiance allegiance)
 {
     //targetedPickUpDictionary[allegiance].Remove(PickUp);
     //openPickUpDictionary[allegiance].Add(PickUp, null);
     openPickUpDictionary[allegiance][PickUp] = null;
 }
Exemplo n.º 13
0
 public static void TargetPickUp(GameObject PickUp, GameObject Worker, GameResources.Allegiance allegiance)
 {
     openPickUpDictionary[allegiance][PickUp] = Worker;
     //openPickUpDictionary[allegiance].Remove(PickUp);
     //targetedPickUpDictionary[allegiance].Add(PickUp, Worker);
 }