}    //All Collisions ON Stay Check

    protected void ProcessBotandCCTouchDamage(Collision col)
    {
        //We must make sure we have a self... if not.. well... return!
        if (self == null)
        {
            return;
        }

        // when was the last time we did damage?  able to do damage every two seconds

        if (!canTouchDamage)
        {
            return;
        }

        //Check if we collide with a CommandCenter.
        if (col.gameObject.CompareTag("CommandCenter") && (!self.IsDestroyed()))         //&& selfAsEnemy.AttackCommandCenters))
        {
            CommandCenter c = col.gameObject.GetComponent <CommandCenter>();

            c.Damage(TouchDamageToCC);
            self.Damage(touchDamageToSelf);                      // this may not kill me
            // we do our damage, set can do damage off and hit the clock
            canTouchDamage   = false;
            touchDamageClock = Time.time;

            //Send the detonation message to the GOT
            GameObjectTracker.GetGOT().TargetDetonated();
        }
        //Check if we collide with a Player Bot
        //TODO:CRashing here.
        if (col.gameObject.CompareTag("Bot") && (!self.IsDestroyed()))         //&& selfAsEnemy.AttackBots))
        {
            Bot b = col.gameObject.GetComponent <Bot>();

            //Dont blow up if shield is active.
            if (b.IsShieldActive())
            {
                return;
            }

            b.Damage(TouchDamageToBot);
            self.Damage(touchDamageToSelf);              // this may not kill me

            //Send the detonation message to the GOT
            GameObjectTracker.GetGOT().TargetDetonated();
            // we do our damage, set can do damage off and hit the clock
            canTouchDamage   = false;
            touchDamageClock = Time.time;
        }



        // end processing bot and cc
    }
    void OnTriggerStay(Collider col)
    {
        //Check if we collide with a CommandCenter.
        if (col.gameObject.CompareTag("CommandCenter"))
        {
            CommandCenter c = col.gameObject.GetComponent <CommandCenter>();
            // if we touch the command Center add health,
            // but only certain amount per second
            if (isAffective && (Time.time - timeStartedGivingHealth) > healthGivingFreq)
            {
                // TODO: for now, we are going to add negative damage, should work
                c.Damage(-healthToGive);

                //Update teh stat.
                GameObjectTracker.instance.HealthCC(healthToGive);

                // print("Giving +" + healthToGive + " to Comman Center!");
                timeStartedGivingHealth = Time.time;
            }
        }
    }    //All Collisions Check
Ejemplo n.º 3
0
    //Controls for development.
    public void TestControls()
    {
        //if(Application.isEditor || Application.platform == RuntimePlatform.OSXPlayer || Application.platform == RuntimePlatform.WindowsPlayer)
        if (true)
        {
            //We will just add on a bit of heat as we press the H button
            if (Input.GetKey(KeyCode.H))
            {
                //Bot_01.Damage(55.0f);
                CommandCenter_01.Damage(55.0f);
            }


            if (Input.GetKeyDown(KeyCode.M))
            {
                //GameObjectTracker.instance._PlayerData.GemBank += 1000;

                ActivityManager.Instance.FadeToBlack();
            }

            //We will just add on a bit of heat as we press the H button
            if (Input.GetKey(KeyCode.C))
            {
                Bot_01.Cool(50.0f);
            }

            if (Input.GetKeyDown(KeyCode.P))
            {
                foreach (string s in Input.GetJoystickNames())
                {
                    print(s);
                }
            }

            if (Input.GetKeyDown(KeyCode.Alpha1))
            {
                ClearFreeCannons();
            }


            if (Input.GetKeyDown(KeyCode.Alpha0))
            {
                AssignCannonSlotTypes();
            }


            if (Input.GetButtonDown("Shoot"))
            {
                Bot_01.Shoot();
                //AnimateAttack();
            }

            if (Input.GetButtonDown("OverHeat"))
            {
                Bot_01.AddHeat(1000.0f);
            }

            if (Input.GetButtonDown("Shield") || Input.GetKeyDown(KeyCode.B))
            {
                Bot_01.ActivateDefense();
            }

            if (Input.GetButtonUp("Shield") || Input.GetKeyUp(KeyCode.B))
            {
                Bot_01.DeactivateDefense();
            }

            //Absolute Input controls for testing purposes
            if (Input.GetAxis("Horizontal") < 0.0f || Input.GetKeyDown(KeyCode.A))
            {
                movingDirection += -(Vector3.right) * -Input.GetAxis("Horizontal");
            }
            if (Input.GetAxis("Horizontal") > 0.0f || Input.GetKeyDown(KeyCode.D))
            {
                movingDirection += (Vector3.right) * Input.GetAxis("Horizontal");
                ;
            }

            if (Input.GetAxis("Vertical") > 0.0f || Input.GetKeyDown(KeyCode.W))
            {
                movingDirection += (Vector3.forward) * Input.GetAxis("Vertical");
            }

            if (Input.GetAxis("Vertical") < 0.0f || Input.GetKeyDown(KeyCode.S))
            {
                movingDirection += -(Vector3.forward) * -Input.GetAxis("Vertical");
            }
        }

        //movingDirection.Normalize();
    }