Ejemplo n.º 1
0
    public static void fireLazer(Vector3 spawnLocation, Vector3 forceApplied)
    {
        if (laserStocks == 0)
        {
            currentPlayerHasFiredCannon = true;
            playerOneCurrentAmmoType    = "Normal";
            SwitchTurns.switchPlayersTurns();
        }

        currentPlayerMaxTravelDistance = true;


        GameObject newBullet = GameObject.CreatePrimitive(PrimitiveType.Sphere);

        newBullet.GetComponent <Collider> ().isTrigger = true;
        newBullet.gameObject.tag = "AOEDamage";

        newBullet.transform.localScale = new Vector3(.5f, .5f, .5f);
        newBullet.transform.position   = spawnLocation;

        newBullet.GetComponent <Renderer> ().material = Resources.Load("Bullet", typeof(Material)) as Material;
        newBullet.AddComponent(System.Type.GetType("BulletExplosion"));

        newBullet.AddComponent <Rigidbody>();
        newBullet.GetComponent <Rigidbody> ().useGravity = false;
        newBullet.GetComponent <Rigidbody>().AddForce(forceApplied);
    }
Ejemplo n.º 2
0
 void OnTriggerEnter(Collider collider)
 {
     if (collider.tag == "Terrain")
     {
         Destroy(collider.gameObject);
     }
     Destroy(gameObject);
     SwitchTurns.switchPlayersTurns();
 }
Ejemplo n.º 3
0
    void Update()
    {
        localAOE += GlobalVariables.speedAOE;

        if (transform.localScale.x < GlobalVariables.sizeAOE)
        {
            //grow the AOE until it hits a specific size and then destroy it
            transform.localScale = new Vector3(1, 1, 1) * localAOE;
        }
        else
        {
            Destroy(gameObject);            //animation has played out, therefore delete it
            //switch players turns now
            SwitchTurns.switchPlayersTurns();
        }
    }