コード例 #1
0
    // Use this for initialization
    void Start()
    {
        if (localPlayerAuthority)
        {
            structure       = this.GetComponent <UnitStructure>();
            structure.HP    = 500;
            structure.HPMax = 500;
            attributeCosts();
            //Debug.Log (structure.costs [0]);
            structure.colorUnit        = gameObject.GetComponent <Renderer>().material.color;
            structure.isInConstruction = true;
            StartCoroutine(structure.waitConstruction(20f, structure.colorUnit));
            //BaseManager.resources -= structure.costs [0];

            structure.healthBar       = GameObject.Find("HealthBarfor" + gameObject.name);
            structure.HP_Bar          = structure.healthBar.GetComponent <Slider>();
            structure.HP_Bar.minValue = 0;
            structure.HP_Bar.maxValue = structure.HPMax;
            structure.HP_Bar.value    = structure.HP;

            structure.theName = "Defensive Unit";
            //GameObject temp = GameObject.Find("Base");
            GameObject temp = GameObject.Find("Base(Clone)");
            structure.BaseUnit = temp.GetComponent <BaseManager>();

            tempName = gameObject.name.Substring(0, 9);
            //Debug.Log(tempName);
            structure.panel = GameObject.Find("BuildPanelfor" + tempName);
            changePanel();
            structure.panel.SetActive(activeMarker);

            disorientDuration = 10f;
            rockCooldown      = 60;
        }
    }
コード例 #2
0
 public void upgrade(float upgradeDur)
 {
     Debug.Log("upgrading special, step" + structure.upgrades);
     structure.upgrades++;
     if (structure.upgrades == 1)
     {
         if (BaseManager.resources - structure.costs[4] >= 0)
         {
             BaseManager.resources -= structure.costs[4];
             BaseManager.notEnough  = "";
             for (int i = 0; i < resourceFields.Length; i++)
             {
                 resourceFields[i].GetComponent <ResourceField>().speed = 3;
             }
             StartCoroutine(structure.waitConstruction(upgradeDur, structure.colorUnit)); //needs to be 30 for upgrades;
             upgradeDuration = 20f;
             repDur          = 20f;
         }
         else
         {
             BaseManager.notEnough = "not enough resources";
         }
     }
     if (structure.upgrades == 2)
     {
         if (BaseManager.resources - structure.costs[4] >= 0)
         {
             BaseManager.resources -= structure.costs[4];
             BaseManager.notEnough  = "";
             StartCoroutine(structure.waitConstruction(upgradeDur, structure.colorUnit));
             for (int i = 0; i < resourceFields.Length; i++)
             {
                 resourceFields[i].GetComponent <ResourceField>().speed = 5;
             }
             repDur          = 15f;
             upgradeDuration = 15f;
         }
         else
         {
             BaseManager.notEnough = "not enough resources";
         }
     }
     Debug.Log("upgrading special");
 }
コード例 #3
0
 public void upgrade(float upgradeDuration)
 {
     structure.upgrades++;
     Debug.Log("upgrading attacking, step" + structure.upgrades);
     if (structure.upgrades == 1)
     {
         if (BaseManager.resources - structure.costs[3] >= 0)
         {
             BaseManager.resources -= structure.costs[3];
             BaseManager.notEnough  = "";
             StartCoroutine(structure.waitConstruction(upgradeDuration, structure.colorUnit)); //needs to be 20;
             upgradeMultiplier = 2;
             mudImpactSpeed    = 0.6f;
             mudImpactDuration = 30f;
         }
         else
         {
             BaseManager.notEnough = "not enough resources";
         }
     }
     if (structure.upgrades == 2)
     {
         if (BaseManager.resources - structure.costs[4] >= 0)
         {
             BaseManager.resources -= structure.costs[4];
             BaseManager.notEnough  = "";
             StartCoroutine(structure.waitConstruction(upgradeDuration, structure.colorUnit));
             missileCooldown = 15f;
             RocksMax        = 60;
             RocksMin        = 40;
         }
         else
         {
             BaseManager.notEnough = "not enough resources";
         }
     }
 }
コード例 #4
0
 public void upgrade(float upgradeDuration)
 {
     Debug.Log("upgrading defensive, step" + structure.upgrades);
     structure.upgrades++;
     if (structure.upgrades == 1)
     {
         if (BaseManager.resources - structure.costs[3] >= 0)
         {
             BaseManager.resources -= structure.costs[3];
             BaseManager.notEnough  = "";
             StartCoroutine(structure.waitConstruction(upgradeDuration, structure.colorUnit)); //needs to be 30 for upgrades;
             cloudDuration        = 13f;
             rockPercentageDamage = 30f;
         }
         else
         {
             BaseManager.notEnough = "not enough resources";
         }
     }
     if (structure.upgrades == 2)
     {
         if (BaseManager.resources - structure.costs[4] >= 0)
         {
             BaseManager.resources -= structure.costs[4];
             BaseManager.notEnough  = " ";
             StartCoroutine(structure.waitConstruction(upgradeDuration, structure.colorUnit));
             cloudDuration        = 15f;
             cloudRadius          = 70;
             rockPercentageDamage = 40f;
         }
         else
         {
             BaseManager.notEnough = "not enough resources";
         }
     }
 }
コード例 #5
0
    // Use this for initialization
    void Start()
    {
        if (localPlayerAuthority)
        {
            resourceFields = new GameObject[3];
            resourceFields = GameObject.FindGameObjectsWithTag("resource");

            structure       = this.GetComponent <UnitStructure>();
            structure.HP    = 200;
            structure.HPMax = 200;
            attributeCosts();
            structure.colorUnit        = gameObject.GetComponent <Renderer>().material.color;
            structure.isInConstruction = true;
            structure.statusUpdater    = status();
            //Debug.Log(structure.statusUpdater);
            StartCoroutine(structure.waitConstruction(20f, structure.colorUnit));
            BaseManager.resources -= structure.costs[0];

            structure.healthBar       = GameObject.Find("HealthBarfor" + gameObject.name);
            structure.HP_Bar          = structure.healthBar.GetComponent <Slider>();
            structure.HP_Bar.minValue = 0;
            structure.HP_Bar.maxValue = structure.HPMax;
            structure.HP_Bar.value    = structure.HP;

            structure.theName = "Special Unit";
            //GameObject temp = GameObject.Find("Base");
            GameObject temp = GameObject.Find("Base(Clone)");
            structure.BaseUnit = temp.GetComponent <BaseManager>();

            tempName = gameObject.name.Substring(0, 9);
            //Debug.Log(tempName);
            structure.panel = GameObject.Find("BuildPanelfor" + tempName);
            changePanel();
            structure.panel.SetActive(activeMarker);

            upgradeDuration = 30f;
            repDur          = 30f;
            repCD           = 60f;
        }
    }
コード例 #6
0
    //bool throwingRocks = false;

    // Use this for initialization
    void Start()
    {
        if (localPlayerAuthority && hasAuthority)
        {
            Debug.Log("BOOM! Attacking Unit Arrived Setting vars!");
            structure       = this.GetComponent <UnitStructure>();
            structure.HP    = 250;
            structure.HPMax = 250;
            //attributeCosts ();

            structure.colorUnit        = gameObject.GetComponent <Renderer>().material.color;
            structure.isInConstruction = true;
            StartCoroutine(structure.waitConstruction(20f, structure.colorUnit)); //needs to be 20;

            structure.healthBar       = GameObject.Find("HealthBarfor" + gameObject.name);
            structure.HP_Bar          = structure.healthBar.GetComponent <Slider>();
            structure.HP_Bar.minValue = 0;
            structure.HP_Bar.maxValue = structure.HPMax;

            structure.theName = "Attacking Unit";
            //GameObject temp = GameObject.Find("Base");
            GameObject temp = GameObject.Find("Base(Clone)");
            structure.BaseUnit = temp.GetComponent <BaseManager>();

            tempName = gameObject.name.Substring(0, 9);
            //	Debug.Log(tempName);
            structure.panel = GameObject.Find("BuildPanelfor" + tempName);
            changePanel();
            structure.panel.SetActive(activeMarker);

            targets    = new Transform[3];
            RocksMin   = 20;
            RocksMax   = 40;
            startAngle = gameObject.transform.rotation.z;
            co         = rockFlurr();
        }
    }
コード例 #7
0
    //bool throwingRocks = false;
    // Use this for initialization
    void Start()
    {
        if (localPlayerAuthority && hasAuthority)
        {
            Debug.Log("BOOM! Attacking Unit Arrived Setting vars!");
            structure = this.GetComponent<UnitStructure>();
            structure.HP = 250;
            structure.HPMax = 250;
            //attributeCosts ();

            structure.colorUnit = gameObject.GetComponent<Renderer>().material.color;
            structure.isInConstruction = true;
            StartCoroutine(structure.waitConstruction(20f, structure.colorUnit)); //needs to be 20;

            structure.healthBar = GameObject.Find("HealthBarfor" + gameObject.name);
            structure.HP_Bar = structure.healthBar.GetComponent<Slider>();
            structure.HP_Bar.minValue = 0;
            structure.HP_Bar.maxValue = structure.HPMax;

            structure.theName = "Attacking Unit";
            //GameObject temp = GameObject.Find("Base");
            GameObject temp = GameObject.Find("Base(Clone)");
            structure.BaseUnit = temp.GetComponent<BaseManager>();

            tempName = gameObject.name.Substring(0, 9);
            //	Debug.Log(tempName);
            structure.panel = GameObject.Find("BuildPanelfor" + tempName);
            changePanel();
            structure.panel.SetActive(activeMarker);

            targets = new Transform[3];
            RocksMin = 20;
            RocksMax = 40;
            startAngle = gameObject.transform.rotation.z;
            co = rockFlurr();
        }
    }
コード例 #8
0
    // Use this for initialization
    void Start()
    {
        if (localPlayerAuthority)
        {
            resourceFields = new GameObject[3];
            resourceFields = GameObject.FindGameObjectsWithTag("resource");

            structure = this.GetComponent<UnitStructure>();
            structure.HP = 200;
            structure.HPMax = 200;
            attributeCosts();
            structure.colorUnit = gameObject.GetComponent<Renderer>().material.color;
            structure.isInConstruction = true;
            structure.statusUpdater = status();
            //Debug.Log(structure.statusUpdater);
            StartCoroutine(structure.waitConstruction(20f, structure.colorUnit));
            BaseManager.resources -= structure.costs[0];

            structure.healthBar = GameObject.Find("HealthBarfor" + gameObject.name);
            structure.HP_Bar = structure.healthBar.GetComponent<Slider>();
            structure.HP_Bar.minValue = 0;
            structure.HP_Bar.maxValue = structure.HPMax;
            structure.HP_Bar.value = structure.HP;

            structure.theName = "Special Unit";
            //GameObject temp = GameObject.Find("Base");
            GameObject temp = GameObject.Find("Base(Clone)");
            structure.BaseUnit = temp.GetComponent<BaseManager>();

            tempName = gameObject.name.Substring(0, 9);
            //Debug.Log(tempName);
            structure.panel = GameObject.Find("BuildPanelfor" + tempName);
            changePanel();
            structure.panel.SetActive(activeMarker);

            upgradeDuration = 30f;
            repDur = 30f;
            repCD = 60f;
        }
    }
コード例 #9
0
    // Use this for initialization
    void Start()
    {
        if (localPlayerAuthority)
        {
            structure = this.GetComponent<UnitStructure>();
            structure.HP = 500;
            structure.HPMax = 500;
            attributeCosts();
            //Debug.Log (structure.costs [0]);
            structure.colorUnit = gameObject.GetComponent<Renderer>().material.color;
            structure.isInConstruction = true;
            StartCoroutine(structure.waitConstruction(20f, structure.colorUnit));
            //BaseManager.resources -= structure.costs [0];

            structure.healthBar = GameObject.Find("HealthBarfor" + gameObject.name);
            structure.HP_Bar = structure.healthBar.GetComponent<Slider>();
            structure.HP_Bar.minValue = 0;
            structure.HP_Bar.maxValue = structure.HPMax;
            structure.HP_Bar.value = structure.HP;

            structure.theName = "Defensive Unit";
            //GameObject temp = GameObject.Find("Base");
            GameObject temp = GameObject.Find("Base(Clone)");
            structure.BaseUnit = temp.GetComponent<BaseManager>();

            tempName = gameObject.name.Substring(0, 9);
            //Debug.Log(tempName);
            structure.panel = GameObject.Find("BuildPanelfor" + tempName);
            changePanel();
            structure.panel.SetActive(activeMarker);

            disorientDuration = 10f;
            rockCooldown = 60;
        }
    }