Example #1
0
 // Use this for initialization
 void Start()
 {           //unchanged starter pack of ammo (will be changed with setting screen)
     ammonum = 0;
     //set up for needed objects and scripts
     ableToShoot = true;
     world       = GameObject.FindGameObjectWithTag("World").GetComponent("World") as World;
     mt          = GameObject.FindGameObjectWithTag("World").GetComponent("ModifyTerrain") as ModifyTerrain;
     if (gameObject.tag == "BSpawnP1")
     {
         player = GameObject.FindGameObjectWithTag("Player1");
         camera = GameObject.FindGameObjectWithTag("Player1Camera");
     }
     if (gameObject.tag == "BSpawnP2")
     {
         player = GameObject.FindGameObjectWithTag("Player2");
         camera = GameObject.FindGameObjectWithTag("Player2Camera");
     }
     p1       = GameObject.FindGameObjectWithTag("P1Hit").GetComponent("PlayerController") as PlayerController;
     p2       = GameObject.FindGameObjectWithTag("P2Hit").GetComponent("PlayerController") as PlayerController;
     pause    = GameObject.FindGameObjectWithTag("Pauser").GetComponent("Pauser") as Pauser;
     bullet   = pause.sBullet;
     rocket   = pause.sRocket;
     shotgun  = pause.sShotgun;
     crocket  = pause.sCRocket;
     cshotgun = pause.sCShotgun;
     missile  = pause.sAirstrike;
     cmissile = pause.sCAirstrike;
 }
Example #2
0
    //public AudioSource aud;

    //public GameObject punchsoundobject;


    // Use this for initialization
    void Start()
    {
        currentAnim = GetComponent <Animation> ();
        anim        = "loop_run_funny";
        p1CanPunch  = true;
        p2CanPunch  = true;

        //punchsoundobject = GameObject.FindGameObjectWithTag ("punchsound");
        //aud = GetComponent ("AudioSource") as AudioSource;
        //punchSound = aud.audio;

        //canPunch = true;

        world = GameObject.FindGameObjectWithTag("World").GetComponent("World") as World;
        mt    = GameObject.FindGameObjectWithTag("World").GetComponent("ModifyTerrain") as ModifyTerrain;

        p1 = GameObject.FindGameObjectWithTag("P1Hit").GetComponent("PlayerController") as PlayerController;
        p2 = GameObject.FindGameObjectWithTag("P2Hit").GetComponent("PlayerController") as PlayerController;
        if (gameObject.tag == "Bot1")
        {
            player = GameObject.FindGameObjectWithTag("Player1");
            camera = GameObject.FindGameObjectWithTag("Player1Camera");
            ammo   = GameObject.FindGameObjectWithTag("BSpawnP1").GetComponent("Shoot") as Shoot;
        }
        if (gameObject.tag == "Bot2")
        {
            player = GameObject.FindGameObjectWithTag("Player2");
            camera = GameObject.FindGameObjectWithTag("Player2Camera");
            ammo   = GameObject.FindGameObjectWithTag("BSpawnP2").GetComponent("Shoot") as Shoot;
        }


        //charMotor = GameObject.FindGameObjectWithTag ("Player1").GetComponent ("CharacterMotor");
    }
Example #3
0
    void Start()
    {
        world = GameObject.FindGameObjectWithTag("World").GetComponent("World") as World;
        mt    = GameObject.FindGameObjectWithTag("World").GetComponent("ModifyTerrain") as ModifyTerrain;
        //robot = GameObject.FindGameObjectWithTag ("roBot").GetComponent ("RobotAnim") as RobotAnim;
        //robot = GameObject.FindGameObjectWithTag ("roBot");

        if (gameObject.tag == "Fist1.1")
        {
            player = GameObject.FindGameObjectWithTag("Player1");
            camera = GameObject.FindGameObjectWithTag("Player1Camera");
        }
        if (gameObject.tag == "Fist1.2")
        {
            player = GameObject.FindGameObjectWithTag("Player1");
            camera = GameObject.FindGameObjectWithTag("Player1Camera");
        }
        if (gameObject.tag == "Fist2")
        {
            player = GameObject.FindGameObjectWithTag("Player2");
            camera = GameObject.FindGameObjectWithTag("Player2Camera");
        }

        p1 = GameObject.FindGameObjectWithTag("P1Hit").GetComponent("PlayerController") as PlayerController;
        p2 = GameObject.FindGameObjectWithTag("P2Hit").GetComponent("PlayerController") as PlayerController;

        fistPunching = "Fist1.1";
    }
Example #4
0
    // Start is called before the first frame update
    void Start()
    {
        GameObject ground = GameObject.FindGameObjectWithTag("ground");

        modifyTerrain   = ground.GetComponent <ModifyTerrain>();
        timeToLive      = explosionTime;
        targetLocation += new Vector3(0.5f, 0.5f, 0f);
    }
Example #5
0
    void Start()
    {
        world = GameObject.FindGameObjectWithTag("World").GetComponent("World") as World;
        mt    = GameObject.FindGameObjectWithTag("World").GetComponent("ModifyTerrain") as ModifyTerrain;

        //p1 = GameObject.FindGameObjectWithTag ("P1Hit").GetComponent ("PlayerController") as PlayerController;
        //p2 = GameObject.FindGameObjectWithTag ("P2Hit").GetComponent ("PlayerController") as PlayerController;
    }
Example #6
0
    // Use this for initialization
    void Start () {
        
        world = GetComponent<WorldOld> ();
        modifyTerrain = GetComponent<ModifyTerrain> ();

        /*GameObject tempPlayerObj = Instantiate ( playerPrefab );
        PlayerController tempPlayerController = tempPlayerObj.GetComponent<PlayerController> ();

        tempPlayerController.gameController = this;
        tempPlayerController.setSpawnPoint ( new Vector3 ( 32, 145, 32 ) );*/
    }
Example #7
0
    // Use this for initialization
    void Start () {

        modifyTerrainScript = GetComponent<ModifyTerrain> ();

        data = new Block[ worldX, worldY, worldZ ];
        preData = new int[ worldX, worldY, worldZ ];
        
        CmdGenerateWorldData ();
        
        ChunkOld.setChunkSize ( chunkSizeXZ, chunkSizeY );

        chunks = new ChunkOld[ Mathf.FloorToInt ( worldX / chunkSizeXZ ),
                        Mathf.FloorToInt ( worldY / chunkSizeY ),
                        Mathf.FloorToInt ( worldZ / chunkSizeXZ ) ];
        
    }
Example #8
0
    public void start()
    {
        //	world=transform.parent.gameObject.GetComponent("World") as World;
        //	world=transform.parent.gameObject.GetComponent("World") as World;
        set=transform.parent.gameObject.GetComponent("Settings") as Settings;
        mTerrain=transform.parent.gameObject.GetComponent("ModifyTerrain") as ModifyTerrain;
        mesh = GetComponent<MeshFilter> ().mesh;
        col = GetComponent<MeshCollider> ();
        col = GetComponent<MeshCollider> ();

        //if(world.terrainHeight(chunkX,chunkZ) < chunkY || world.terrainHeight(chunkX,chunkZ) > chunkY + 16 )
        //	Destroy(transform.gameObject);

        terrainHeightMod = new float[chunkSize,chunkSize];
        Array.Clear(terrainHeightMod, 0,terrainHeightMod.Length);
        GenerateMesh();
    }
Example #9
0
    //Vector3 targetPos;

    void Start()
    {
        //world = gameObject.GetComponent ("World") as World;
        mod = GameObject.FindGameObjectWithTag("World").GetComponent("ModifyTerrain") as ModifyTerrain;
        //cameraGO = GameObject.FindGameObjectWithTag ("MainCamera");

        // Set variables per instance of object
        fallSpeed = Random.Range(minFallSpeed, maxFallSpeed);
        //Debug.Log (fallSpeed);
        missileScale = Random.Range(minScale, maxScale);
        dirX         = Random.Range(-0, 0);
        dirZ         = Random.Range(-0, 0);
        rotX         = Random.Range(-0f, 0f);
        rotY         = Random.Range(-15f, 15f);
        rotZ         = Random.Range(-0f, 0f);

        // Apply scale transformation
        transform.localScale = new Vector3(missileScale, missileScale, missileScale);

        /*
         * // Creates target telegraph
         * Ray ray = new Ray(transform.position, new Vector3(0f,-100f,0f));
         * RaycastHit hit;
         *
         * if (Physics.Raycast (ray, out hit)) {
         *      if (hit.distance < range) {
         *              targetPos = hit.point;
         *              targetPos += (hit.normal * -0.5f);
         *              Instantiate (target, targetPos, transform.rotation);
         *
         *              Debug.Log ("Target's raycast hit: " + targetPos.x + ", " + targetPos.y + ", " + targetPos.z);
         *      }
         *      Debug.DrawLine(ray.origin,ray.origin+( ray.direction*hit.distance),Color.yellow,2);
         * }
         *
         * Instantiate (target, targetPos, transform.rotation);
         */

        range = 1f;
    }
Example #10
0
 // Use this for initialization
 void Start()
 {
     hasHit = false;
     transform.LookAt(end.transform);
     mt    = GameObject.FindGameObjectWithTag("World").GetComponent("ModifyTerrain") as ModifyTerrain;
     p1    = GameObject.FindGameObjectWithTag("P1Hit").GetComponent("PlayerController") as PlayerController;
     p2    = GameObject.FindGameObjectWithTag("P2Hit").GetComponent("PlayerController") as PlayerController;
     pause = GameObject.FindGameObjectWithTag("Pauser").GetComponent("Pauser") as Pauser;
     if (gameObject.tag == "CMissile")
     {
         ammotype = 6;
     }
     else if (gameObject.tag == "Missile")
     {
         ammotype = 5;
     }
     else if (gameObject.tag == "CShotgun1" || gameObject.tag == "CShotgun2")
     {
         ammotype  = 4;
         explosion = null;
     }
     else if (gameObject.tag == "Shotgun1" || gameObject.tag == "Shotgun2")
     {
         ammotype  = 3;
         explosion = null;
     }
     else if (gameObject.tag == "CRocket1" || gameObject.tag == "CRocket2")
     {
         ammotype = 2;
     }
     else if (gameObject.tag == "Rocket1" || gameObject.tag == "Rocket2")
     {
         ammotype = 1;
     }
     else
     {
         explosion = null;
         ammotype  = 0;
     }
 }
 public void Start()
 {
     playerSpeed      = 10.0f;
     originalRotation = mainCamera.transform.localRotation;
     modifyTerrian    = GameObject.Find("World").GetComponent <ModifyTerrain>();
 }
Example #12
0
 private void Awake()
 {
     body   = GetComponent <Rigidbody>();
     modify = GetComponentInChildren <ModifyTerrain>();
 }