コード例 #1
0
ファイル: SuperSpeed.cs プロジェクト: 0c0de/FlyPlane
 // Use this for initialization
 void Start()
 {
     //Buscamos los scripts referenciados
     m_Random = GameObject.FindGameObjectWithTag("Obstaculos").GetComponent<RandomSpawn>();
     m_Obstaculos = GameObject.FindGameObjectWithTag ("Colum").GetComponent<Obstacle> ();
     m_Player = GameObject.FindGameObjectWithTag ("Check");
 }
コード例 #2
0
    void Shoot()
    {
        if (Input.GetMouseButton(0) && bodiesVisible == true)
        {
            Physics.Raycast(myFPSCamera.transform.position, myFPSCamera.transform.forward, out hitscanTarget, 500);

            parentGameObject = hitscanTarget.transform.parent.gameObject;

            if (hitscanTarget.transform.tag == "EnemyHurtbox")
            {
                RandomSpawn.DestroyObjectInList(parentGameObject);
                Debug.Log("HIT!");
            }
            else if (hitscanTarget.transform.tag == "EnemyBody")
            {
                Debug.Log("He's not actually there!");
            }
            else
            {
                Debug.Log("Where are you shooting?");
            }
        }
        else
        {
            Debug.Log("You can't shoot while you can't see their bodies!");
        }
    }
コード例 #3
0
 void OnCollisionEnter(Collision collision)
 {
     if (collision.collider.tag == "Target")
     {
         RandomSpawn rs = TargetSpawner.GetComponent <RandomSpawn>();
         rs.OnTargetHit();
     }
 }
コード例 #4
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            Application.LoadLevel("Main menu");
            if (PlayerPrefs.GetString("MusicBackground") != "no")
            {
                GameObject.Find("BackgroundMusic").GetComponent <AudioSource>().Play();
            }
            else
            {
                GameObject.Find("BackgroundMusic").GetComponent <AudioSource>().Stop();
            }
        }
        RandomSpawn    randomSpawn    = RandomSpawnScript.GetComponent <RandomSpawn>();
        MainScriptBall mainScriptBall = MainBall.GetComponent <MainScriptBall>();

        if (mainScriptBall.GameOver)
        {
            clicktostartgame.text = "Click anywhere to restart game";
            clicktostartgame.transform.position = new Vector3(Camera.main.transform.position.x, Camera.main.transform.position.y - 7, 1);
            Startgame = false;
            mainScriptBall.GameOver = false;
            PlayAudio(deadClip);
        }

        if (Input.GetKeyUp(KeyCode.Mouse0) && !Startgame)
        {
            Camera.main.orthographicSize      = 6f;
            Camera.main.transform.position    = new Vector3(0, 0, -10);
            HealtsObject.transform.position   = new Vector3(0, 5, 0);
            HealtsObject.transform.localScale = new Vector2(0.14f, 0.12f);
            MainBall.transform.position       = new Vector3(Camera.main.transform.position.x, Camera.main.transform.position.y, 0);
            MainBall.SetActive(true);
            mainScriptBall.Healts = 100f;
            mainScriptBall.Score  = 0;
            mainScriptBall.hightScoreText.text = "";
            mainScriptBall.SpawnParticalEffect(mainScriptBall.destroyEffectBlue);
            mainScriptBall.rg.velocity = new Vector2(0, 0);
            clicktostartgame.text      = "";
            Startgame                      = true;
            mainScriptBall.Click           = false;
            mainScriptBall.rg.gravityScale = 1.3f;
            PlayAudio(startClip);
            randomSpawn.RandomSpawnObject();
        }
        if (startgame)
        {
            if (Camera.main.orthographicSize < 8f)
            {
                Camera.main.orthographicSize += 0.1f;
                if (Camera.main.orthographicSize >= 8f)
                {
                    Camera.main.orthographicSize = 8f;
                }
            }
        }
    }
コード例 #5
0
    void Start()
    {
        spawnScript = GetComponentInParent<RandomSpawn>();
        numOfEnemiesStart = spawnScript.SpawnsPerWave ;
        numOfEnemies = numOfEnemiesStart;

        enemyCounterComponent = GetComponent<GUIText>();

        enemyCounterComponent.text ="Scientists: " + numOfEnemies.ToString() + "/" + numOfEnemiesStart.ToString();
    }
コード例 #6
0
    void Update()
    {
        RandomSpawn rs     = TargetSpawner.GetComponent <RandomSpawn>();
        GameObject  target = rs.target; // the target variable points to the current target

        // A target will randomly spawn somewhere within the arm's reach
        // The arm needs to rotate to face the target, then move down 90 degrees to touch it
        // When the arm touches the target, the target will disappear, and a new target will appear somwhere else

        // TODO: implement the arm movement logic so that the arm can automically find the target when it appears
    }
コード例 #7
0
    public void ResetGame()
    {
        Destroy(Dustbox.instance.gameObject);

        CatController cat = GameObject.FindObjectOfType(typeof(CatController)) as CatController;

        cat.Reset();

        RandomSpawn spawn = GameObject.FindObjectOfType(typeof(RandomSpawn)) as RandomSpawn;

        spawn.enabled = true;
    }
コード例 #8
0
 void EnemyVisibility()
 {
     if (Input.GetKey(KeyCode.E))
     {
         RandomSpawn.VisibleBodies();
         bodiesVisible = true;
     }
     if (Input.GetKey(KeyCode.Q))
     {
         RandomSpawn.VisibleHurtboxes();
         bodiesVisible = false;
     }
 }
コード例 #9
0
    void Start()
    {
        Menu.menu.scorePanel = scorePanel;
        Menu.menu.scoreText  = menuScoreText;

        _randomSpawn = GetComponent <RandomSpawn>();

        _tower          = GameObject.Find("Tower");
        _towerComponent = _tower.GetComponent <Tower>();
        _pipeDirection  = _tower.GetComponent <PipeDirectionController>();
        _pipes          = _tower.GetComponent <Pipes>();

        _towerComponent.SetScore(0);

        Spawn();
    }
コード例 #10
0
    // Use this for initialization
    void Start()
    {
        LevelPoints = GameObject.FindGameObjectsWithTag("LevelPoint");
        int rando = Random.Range(levelMinimum, LevelPoints.Length);

        for (int x = 0; x < rando; x++)
        {
            int y = Random.Range(0, LevelSection.Length);
            Instantiate(LevelSection[y], LevelPoints[x].transform.position, Quaternion.identity);
        }
        RandomSpawn spawn = this.gameObject.GetComponent <RandomSpawn>();

        spawn.Plort();
        TeleportControl tele = this.gameObject.GetComponent <TeleportControl>();

        tele.KickStarter();
    }
コード例 #11
0
ファイル: Enemy.cs プロジェクト: MecIntyre/AdventureGame
    /// <summary>
    /// Zerstört den Feind, wenn er vom Schwert getroffen wird.
    /// (Wird aufgerufen von Sword.onCollisionDetected.)
    /// </summary>
    public void OnHitBySword()
    {
        RandomSpawn rs = GetComponent <RandomSpawn>();

        if (rs != null)
        {
            GameObject item = rs.Spawn(); //Zufällig gespawnter Schatz.
            if (item != null)
            {
                item.transform.position = transform.position;
            }
        }

        GameObject explosion = Instantiate(explosionPrototype, transform.parent);

        explosion.transform.position = transform.position;

        SaveGameData.current.RecordDestroy(gameObject); //Destroy(gameObject);
    }
コード例 #12
0
    IEnumerator GameClear()
    {
        RandomSpawn      spawn      = GameObject.FindObjectOfType(typeof(RandomSpawn)) as RandomSpawn;
        PlayerController controller = GameObject.FindObjectOfType(typeof(PlayerController)) as PlayerController;
        MusicController  sound      = GameObject.FindObjectOfType(typeof(MusicController))  as MusicController;
        AudioClip        clip       = Resources.Load("Audio/bgm-jingle1") as AudioClip;

        Dustbox.instance.StopFishes();
        spawn.enabled      = false;
        controller.enabled = false;

        if (sound != null)
        {
            Destroy(sound.gameObject);
        }

        AudioSource.PlayClipAtPoint(clip, Vector3.zero);

        yield return(new WaitForSeconds(clip.length));

        Destroy(Dustbox.instance.gameObject);
        Application.LoadLevel("Clear");
    }
コード例 #13
0
    public static void Miss()
    {
        Dustbox.instance.StopFishes();
        RandomSpawn spawn = GameObject.FindObjectOfType(typeof(RandomSpawn)) as RandomSpawn;

        spawn.enabled = false;
        Dustbox.instance.StopBullet();

        instance.hp     -= 1;
        spawn.spawnCount = instance.killCount - 1;


        // GameOver
        if (instance.hp <= 0)
        {
            instance.StartCoroutine(instance.GameOver());
        }
        else
        {
            instance.animation.Play();
        }

        instance.animation.Play();
    }
コード例 #14
0
ファイル: Bush.cs プロジェクト: MecIntyre/AdventureGame
    protected IEnumerator PlayOnHitBySwordAni()
    {
        isHitAniPlaying = true;

        RandomSpawn rs = GetComponent <RandomSpawn>();

        if (rs != null)
        {
            GameObject item = rs.Spawn(); //Zufällig gespawnter Schatz.
            if (item != null)
            {
                item.transform.position = transform.position;
            }
        }

        SpriteRenderer sr = GetComponent <SpriteRenderer>();

        for (int i = 0; i < destructionFrames.Length; i++)
        {
            sr.sprite = destructionFrames[i];
            yield return(new WaitForSeconds(duration / destructionFrames.Length));
        }
        SaveGameData.current.RecordDestroy(gameObject);
    }
コード例 #15
0
ファイル: Jump.cs プロジェクト: 0c0de/FlyPlane
    void Start()
    {
        m_Obstacle = GameObject.FindGameObjectWithTag("Obstaculos").GetComponent<RandomSpawn>();
        camara = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<MuscaJuego>();
        coin = GameObject.FindGameObjectWithTag ("coin").GetComponent<Coins> ();
        rigid = GetComponent<Rigidbody2D>();
        avion = gameObject;
        m_RandomNumber = Random.value;

        m_ADS.RequestInterstitial ();
        m_ADS.RequestRewardBasedVideo ();
    }
コード例 #16
0
 // Use this for initialization
 //Accessing the spawnAliveSeconds from RandomSpawn Script
 void Start()
 {
     randomSpawnAcess   = spawnerObject.GetComponent <RandomSpawn>();
     randomSpawnSeconds = randomSpawnAcess.spawnAliveSeconds;
     Destroy(gameObject, randomSpawnSeconds);
 }
コード例 #17
0
 // Use this for initialization
 void Start()
 {
     randomSpawn = GetComponentInParent<RandomSpawn>();
     waveNumber = randomSpawn.WaveCounter;
     GetComponent<GUIText>().text ="Wave: " + waveNumber.ToString();
 }