상속: MonoBehaviour
예제 #1
0
    // Update is called once per frame
    void Update()
    {
        if (gripAction.GetLastStateDown(handType))
        {
            if (collidingObject && collidingObject.tag != "Bubble")
            {
                GrabObject();
            }
        }

        if (gripAction.GetLastStateUp(handType))
        {
            if (objectInHand)
            {
                ReleaseObject();
            }
        }
        if (swapAction.GetState(SteamVR_Input_Sources.LeftHand) && swapAction.GetState(SteamVR_Input_Sources.RightHand) && !swapped)
        {
            print("Swapped");
            swapped = true;
            ControllerActionScript controlScript = GetComponent <ControllerActionScript>();
            controlScript.enabled = !controlScript.enabled;
            LaserScript laserScript = GetComponent <LaserScript>();
            laserScript.enabled = !laserScript.enabled;
        }
        else if (!swapAction.GetState(SteamVR_Input_Sources.LeftHand) && !swapAction.GetState(SteamVR_Input_Sources.RightHand) && swapped)
        {
            print("deswap");
            swapped = false;
        }
    }
예제 #2
0
    /// <summary>
    /// 发射子弹的防御塔在发射时调用
    /// </summary>
    /// <param name="es"></param>
    /// <returns></returns>
    public virtual TurretAttack Shoot(EnemyScript es)
    {
        GameObject attack = Instantiate(attackPrefab);

        if (type == BULLET)
        {
            attack.transform.position = this.transform.position;

            BulletScript bs = attack.GetComponent <BulletScript>();

            bs.SetBullet(this);

            bs.flying = true;
            return(bs);
        }
        else if (type == EXPLOSION)
        {
            attack.transform.position = target.transform.position;
            ExplosionScript explode = attack.GetComponent <ExplosionScript>();

            explode.SetExplosion(this);
            explode.Explode();
        }
        else if (type == LASER)
        {
            LaserScript ls = attack.GetComponent <LaserScript>();
            ls.SetLaser(this);
            ls.Emit();
        }

        return(null);
    }
예제 #3
0
    public void Previous()
    {
        count--;

        if (count < 0)
        {
            count = Lasers.Count;
        }

        for (int i = 0; i < Lasers.Count; i++)
        {
            if (count == i)
            {
                laserScript.DisableLaserCaller(0);
                activeLaser = Lasers [i];
                activeLaser.SetActive(false);
                laserScript = activeLaser.GetComponent <LaserScript> ();
                newSize     = 1;
            }
            if (effectName != null)
            {
                effectName.text = activeLaser.name;
            }
            if (bouncesText != null)
            {
                bouncesText.text = "Bounces: " + laserScript.bounces;
            }
            if (sizeText != null)
            {
                sizeText.text = "Size: " + laserScript.size;
            }
        }
    }
예제 #4
0
    void Start()
    {
        manager = GameObject.Find("Main Camera").GetComponent <NPCManager>();

        characterController = GetComponent <CharacterController>();
        //weaponText = canvas.GetComponentInChildren<Text>();

        shield = gameObject.GetComponentInChildren <ShieldScript>();
        laser  = gameObject.GetComponentInChildren <LaserScript>();
        charge = gameObject.GetComponentInChildren <ChargeScript>();
        bomb   = gameObject.GetComponentInChildren <BombScript>();

        laserSound = gameObject.GetComponent <AudioSource>();

        cameraScript = GameObject.Find("Main Camera").GetComponent <CameraFollow>();

        futurePosition = GetComponentInChildren <FuturePositionScript>().transform;

        if (Input.GetJoystickNames().Length > 0)
        {
            isControllerConnected = true;
        }

        transform.position = spawnPoint;

        if (GameObject.Find("PlayerUI"))
        {
            ui = GameObject.Find("PlayerUI").GetComponent <PlayerUI>();
        }
    }
예제 #5
0
    public void GraphOn(GameObject city, Material mat)
    {
        if (graphon == false)
        {
            graphlinks = new GameObject[1200];
            graphcount = 0;
            graphon    = true;
        }
        bool newlink = false;

        if (graphcount > maxgraph)
        {
            graphlinks [graphcount] = GameObject.Instantiate(thin_laser_prefab, position(), gameobject.transform.rotation);
            graphlinks [graphcount].transform.SetParent(gameobject.transform, true);
            maxgraph = graphcount;
            newlink  = true;
        }
        LaserScript ls = (LaserScript)graphlinks [graphcount].GetComponent(typeof(LaserScript));

        if (newlink)
        {
            ls.line = ls.GetComponent <LineRenderer> ();
        }
        ls.SetPos(gameobject.transform.position, city.transform.position);
        if (mat != null)
        {
            ls.ChangeMaterial(mat);
        }
        graphcount++;
    }
예제 #6
0
    void OnCollisionEnter2D(Collision2D theCollision)
    {
        if (theCollision.gameObject.name.Contains("laser"))
        {
            LaserScript laser = theCollision.gameObject.GetComponent("LaserScript") as LaserScript;
            health -= laser.damage;
            Destroy(theCollision.gameObject);
            GetComponent <AudioSource>().PlayOneShot(hitSound);
        }
        if (health <= 0)
        {
            if (explosion)
            {
                ;
            }
            {
                GameObject exploder = ((Transform)Instantiate(explosion, this.transform.position, this.transform.rotation)).gameObject;
                Destroy(exploder, 2.0f);
            }

            Destroy(this.gameObject);
            GameController controller = GameObject.FindGameObjectWithTag("GameController").GetComponent("GameController") as GameController;
            controller.KilledEnemy();
        }
    }
예제 #7
0
    /// <summary>
    /// Shoot if possible. (See this.CanShoot)
    /// </summary>
    /// <param name="isEnemy">
    ///     If set to <c>true</c>, the shot belongs to game enemies.
    ///     Otherwise, it belongs to the player.
    /// </param>
    public void Shoot(bool isEnemy)
    {
        if (this.CanShoot)
        {
            // we're counting down from the threshold
            this.cooldownTime = this.cooldownTimeThreshold;

            // create a new laser and set it to where I am
            Transform laserTransform = (Transform)Instantiate(laserPrefab);
            laserTransform.position = isEnemy ?
                                      new Vector2(this.transform.position.x - 0.5f, this.transform.position.y)      //place the laser to the left of the enemy
                                        : new Vector2(this.transform.position.x + 0.5f, this.transform.position.y); //place the laser to the right of the player

            LaserScript laser = laserTransform.gameObject.GetComponent <LaserScript>();
            if (laser != null)
            {
                laser.isEnemyShot = isEnemy;                 //assign the laser to enemies or the player
            }

            // modify the laser's movement
            MoveScript laserMovement = laserTransform.gameObject.GetComponent <MoveScript>();
            if (laserMovement != null)
            {
                //if this is a laser that belongs to the enemy, move it toward the player,
                //and vice-versa
                laserMovement.direction = isEnemy ? -Vector2.up : Vector2.up;
            }
        }
    }
예제 #8
0
    //Попадание лазера
    void OnCollisionEnter2D(Collision2D theCollision)
    {
        //Проверяем коллизию с объектом типа «лазер»
        if (theCollision.gameObject.name.Contains("laser"))
        {
            LaserScript laser = theCollision.gameObject.GetComponent("LaserScript") as LaserScript;
            Enemyhealth -= laser.damage;
            Destroy(theCollision.gameObject);
            // Воспроизвести звук попадания выстрела
            GetComponent <AudioSource>().PlayOneShot(hitSound);
        }


        if (Enemyhealth <= 0)
        {
            // Срабатывает при уничтожении объекта
            if (explosion)
            {
                GameObject exploder = ((Transform)Instantiate(explosion, this.transform.position, this.transform.rotation)).gameObject;
                Destroy(exploder, 2.0f);
            }

            Destroy(this.gameObject);

            GameController controller = GameObject.FindGameObjectWithTag("GameController").GetComponent("GameController") as GameController;
            controller.KilledEnemy();
            controller.IncreaseScore(10);
        }
    }
예제 #9
0
    public void LinkOn(GameObject city)
    {
        LaserScript ls = (LaserScript)links[_linkson].GetComponent(typeof(LaserScript));

        ls.SetPos(gameobject.transform.position, city.transform.position);
        _linkson++;
    }
예제 #10
0
    void HitByLaser(Collider2D other)
    {
        dead = true;
        animator.SetBool("dead", dead);
        LaserScript ls = other.gameObject.GetComponent <LaserScript>();

        ls.audioSource.Play();
    }
예제 #11
0
 void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.tag == "Bullet")
     {
         LaserScript script = other.GetComponent <LaserScript>();                            //Pobierz obrażenia pocisku i odejmij od HP
         Health -= script.damage;
         Destroy(other.gameObject);
     }
 }
예제 #12
0
    public void FinalizeLasers(float speed, Material isl_material)
    {
        // Turn off lasers that are no longer assigned to the same target
        for (int lc = 0; lc < maxlasers; lc++)
        {
            if (laseron [lc])
            {
                if (!IsAssigned(laserdsts [lc]))
                {
                    // laser will need to be reassigned
                    laseron[lc] = false;
                }
            }
        }

        for (int i = 0; i < assignedcount; i++)
        {
            SatelliteSP0031 sat = assignedsats [i];
            if (!WasAssigned(sat))
            {
                /* destination is a new one - find a laser */
                int lasernum = FindFreeLaser();
                laseron [lasernum]    = true;
                lasertimes [lasernum] = Time.time;
                laserdsts [lasernum]  = sat;
                LaserScript ls = (LaserScript)lasers [lasernum].GetComponent(typeof(LaserScript));
                ls.SetMaterial(isl_material);
            }
        }

        int oncount = 0;

        for (int lc = 0; lc < maxlasers; lc++)
        {
            if (laseron [lc])
            {
                oncount++;
                LaserScript ls = (LaserScript)lasers [lc].GetComponent(typeof(LaserScript));
                Debug.Assert(this != laserdsts [lc]);
                if (position() == laserdsts [lc].position())
                {
                    Debug.Log("Same pos");
                    Debug.Log("Me: " + satid.ToString() + " Him: " + laserdsts [lc].satid.ToString());
                    Debug.Log("My pos: " + position().ToString() + " His pos: " + laserdsts [lc].position().ToString());
                }
                Debug.Assert(position() != laserdsts [lc].position());

                ls.SetPos(position(), laserdsts [lc].position());
                //ls.SetMaterial (isl_material);
            }
            else
            {
                LaserScript ls = (LaserScript)lasers [lc].GetComponent(typeof(LaserScript));
                ls.SetPos(position(), position());
            }
        }
    }
	// Use this for initialization
	void Start () {
		po = light.transform.position;
		sc = light.transform.localScale;
		objPlayer = (GameObject) GameObject.FindWithTag ("Player");
		objAIScriptAI  = (AIscript) objPlayer.GetComponent( typeof(AIscript) );
		laserscript = (LaserScript) Laser.GetComponent( typeof(LaserScript) );
		objCamera = (GameObject) GameObject.FindWithTag ("MainCamera");
		ptrGameScript = (gameScript)objCamera.GetComponent( typeof(gameScript) );
	}
예제 #14
0
 public void Fire(Vector3 targetPosition)
 {
     if (Time.time - lastFired > (1.0f / frequency))
     {
         Quaternion  rotation = Quaternion.LookRotation(targetPosition);
         LaserScript laser    = Object.Instantiate(enemyProjectile, transform.position, rotation).GetComponent <LaserScript>();
         laser.Initialize(self);
         lastFired = Time.time;
     }
 }
예제 #15
0
 private void SpawnLaser(IGameObject turret, Scene world, Vector2f laserSpeed)
 {
     var gunPosition = turret.Body.Incircle.Radius * turret.Body.Rotation.Normalize();
     var shotPosition = turret.Body.Incircle.Center + gunPosition;
     var laser = ObjectsManager.Build((uint)ObjectID.Laser, shotPosition);
     var laserScript = new LaserScript(laserSpeed, ObjectID.Turret);
     laser.BindScript(laserScript);
     laser.Lighting.Add(new Light(new Vector2f(0.1f, 0.1f), Color.Magenta, LightMode.Flashlight));
     world.Add(laser);
 }
예제 #16
0
    // Use this for initialization
    void Start()
    {
        cam       = Camera.main;
        lasergun  = GetComponentInChildren <LaserScript>();
        inventory = GetComponent <Inventory>();

        ramTime = ramCooldown;
        speed   = defaultSpeed;
        ramOn   = false;
    }
예제 #17
0
 void Start()
 {
     for (int i = 0; i < Lasers.Count; i++)
     {
         Lasers [i].SetActive(false);
     }
     activeLaser = Lasers [0];
     activeLaser.SetActive(true);
     laserScript = activeLaser.GetComponent <LaserScript> ();
 }
예제 #18
0
 public void LinkOff()
 {
     if (_linkson > 0)
     {
         for (int linknum = 0; linknum < 2; linknum++)
         {
             LaserScript ls = (LaserScript)links [linknum].GetComponent(typeof(LaserScript));
             ls.SetPos(position(), position());
         }
         _linkson = 0;
     }
 }
예제 #19
0
파일: Player.cs 프로젝트: tunerok/Space-Com
    void OnTriggerEnter2D(Collider2D theCollision)
    {
        if (theCollision.gameObject.name.Contains("laser(Clone)"))
        {
            //чекаем сколько отнимает данная пушка и отнимаем хп
            LaserScript laser = theCollision.gameObject.GetComponent("LaserScript") as LaserScript;
            HP -= laser.damage;
            // hited.transform.position = this.transform.position;


            // Destroy(theCollision.gameObject);
        }
    }
예제 #20
0
 public void ColourLink(SatelliteSP0031 nextsat, Material mat)
 {
     for (int lc = 0; lc < maxlasers; lc++)
     {
         if (laseron [lc])
         {
             if (laserdsts [lc] == nextsat)
             {
                 LaserScript ls = (LaserScript)lasers [lc].GetComponent(typeof(LaserScript));
                 ls.SetMaterial(mat);
             }
         }
     }
 }
예제 #21
0
    public void LaserSetting()
    {
        laserMoveTime = GameManager.instance.laserMoveTime;
        isLaserOn     = false;

        Coroutine             = UpLaser();
        newLaser              = Instantiate(LaserPrefab);
        laserScript           = newLaser.GetComponent <LaserScript>();
        laserScript.trail     = false;
        laserScript.firePoint = transform.Find("StartPoint").gameObject;
        laserScript.endPoint  = transform.Find("EndPoint").gameObject;
        newLaser.SetActive(true);
        laserScript.ShootLaser(512);
    }
예제 #22
0
    public bool isEnemy = true; // variable pour indiquer si c'est un ennemie ou non

    // methode de base de unity qui détécte les colision entrante entre des game object qui un collider et un rigidBody
    void OnCollisionEnter2D(Collision2D coll)
    {
        // on unBox notre collider
        var collider = coll.collider;
        // on récupére notre laser script attacher au collider
        LaserScript shot = collider.gameObject.GetComponent <LaserScript>();


        // si le script as bien été récupéré
        if (shot != null)
        {
            // si le laser que l'on reçois et different de ce qu'on ai ( ennemie ou non )
            if (shot.ennemi != isEnemy)
            {
                // le collider est bien activé
                collider.enabled = true;
                // on réduite les poit de vie par raport au nombre de dommage du laser
                hp -= shot.damage;
                // on détruit le laser
                Destroy(shot.gameObject);

                // si les point de vie sont a 0
                if (hp <= 0)
                {
                    // on récupére le score manager
                    GameObject scoreManager = GameObject.Find("Scripts");
                    //si c'est un ennemie
                    if (isEnemy)
                    {
                        // on augmente le score
                        scoreManager.GetComponent <ScoreManager>().score += 200;
                        // on detruit l'ennemie
                        Destroy(gameObject);
                    }
                    // si c'est un joueur
                    else
                    {
                        // on met le jeu en gameOver
                        scoreManager.GetComponent <ScoreManager>().gameOver = true;
                    }
                }
            }
            else
            {
                // on desactive les colision
                collider.enabled = false;
            }
        }
    }
예제 #23
0
    // Update is called once per frame
    void Update()
    {
        Vector3 myPos = new Vector3(transform.position.x, transform.position.y, 0);

        if (timer == 0)
        {
            LaserScript laser1 = Instantiate(las, myPos, Quaternion.identity);
            laser1.angle = angle;
            // laser1.moveSpeed = projspeed;
            timer = 999999;
        }
        else
        {
            timer--;
        }
    }
예제 #24
0
    private void OnTriggerEnter2D(Collider2D collider)
    {
        LaserScript shot = collider.gameObject.GetComponent <LaserScript>();

        //Is this a player shot?
        if (shot != null && shot.isEnemyShot != isEnemy)
        {
            this.healthPoints -= shot.damage;     //apply damage
            Destroy(shot.gameObject);             //destroy the game object!

            if (this.healthPoints <= 0)
            {
                Destroy(this.gameObject);                 //I'm dead! X_X
            }
        }
    }
예제 #25
0
 public void RefreshLaser()
 {
     for (int i = 0; i < Lasers.Count; i++)
     {
         laserScript = Lasers[i].GetComponent <LaserScript> ();
         if (fixedCamera.gameObject.activeSelf)
         {
             laserScript.firePoint = Lasers [i];
             laserScript.endPoint  = fixedCamera;
         }
         else
         {
             laserScript.firePoint = fpsCamera.transform.FindDeepChild("FirePoint").gameObject;
             laserScript.endPoint  = fpsCamera;
         }
     }
 }
예제 #26
0
    void OnCollisionEnter2D(Collision2D coll)

    {
        Debug.Log("test");
        var         collider = coll.collider;
        LaserScript shot     = collider.gameObject.GetComponent <LaserScript>();

        if (shot != null)
        {
            ///lol
            hp -= shot.damage;
            Destroy(shot.gameObject);
            if (hp <= 0)
            {
                Destroy(gameObject);
            }
        }
    }
예제 #27
0
    void Start()
    {
        activeLaser = Lasers [0];
        laserScript = activeLaser.GetComponent <LaserScript> ();

        if (effectName != null)
        {
            effectName.text = activeLaser.name;
        }
        if (bouncesText != null)
        {
            bouncesText.text = "Bounces: " + laserScript.bounces;
        }
        if (sizeText != null)
        {
            sizeText.text = "Size: " + newSize;
        }
        originalSize = laserScript.size;
    }
예제 #28
0
    IEnumerator CycleLasers()
    {
        for (int i = 0; i < Lasers.Count; i++)
        {
            newLaser              = Instantiate(Lasers [i]);
            laserScript           = newLaser.GetComponent <LaserScript> ();
            laserScript.trail     = false;
            laserScript.firePoint = playerFirePoint;
            laserScript.endPoint  = targetPoints [Random.Range(0, targetPoints.Count)].gameObject;
            newLaser.SetActive(true);
            laserScript.ShootLaser(3);

            yield return(longWait);

            Destroy(newLaser);
        }

        StartCoroutine(CycleLasers());
    }
예제 #29
0
    private void LoadLasers(Laser[] lasers)
    {
        foreach (Laser laser in lasers)
        {
            Vector3    position = new Vector3(laser.x, laser.y, 0);
            Quaternion rotation = Quaternion.Euler(0, 0, laser.rotation);


            GameObject instantiated = Instantiate(laserPrefab);

            instantiated.transform.position = position;
            instantiated.transform.rotation = rotation;

            LaserScript laserScript = instantiated.GetComponentInChildren <LaserScript>();

            laserScript.offset     = laser.offset;
            laserScript.reloadTime = laser.reloadTime;
            laserScript.fireTime   = laser.fireTime;
            laserScript.viewportX  = laser.viewportX;
        }
    }
예제 #30
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.Space))
     {
         LaserScript laser = Object.Instantiate(FriendlyProjectile, transform.position, Ship.transform.rotation).GetComponent <LaserScript>();
         laser.Initialize(Ship);
     }
     if (LockedOnMaster.searching)//enable the charge effect.
     {
         em.enabled = true;
     }
     else if (!LockedOnMaster.searching && !LockedOnMaster.lockedOn)
     {
         em.enabled = false;
     }
     if (LockedOnMaster.lockedOn)
     {
         fireUponRelease = true;
     }
     if (fireUponRelease)
     {
         fireUponRelease = false;
         if (Input.GetKeyUp(KeyCode.Space))
         {
             fireUponRelease = false;
             em.enabled      = false;
             Quaternion targetRotation = CreateRotation();
             if (AimingScript.locked)
             {
                 LaserScript laser = Object.Instantiate(LockedProjectile, transform.position, targetRotation).GetComponent <LaserScript>();
                 laser.Initialize(Ship);
             }
             else
             {
                 LaserScript laser = Object.Instantiate(FriendlyProjectile, transform.position, targetRotation).GetComponent <LaserScript>();
                 laser.Initialize(Ship);
             }
         }
     }
 }
예제 #31
0
    public void Previous()
    {
        count--;

        if (count < 0)
        {
            count = Lasers.Count;
        }

        for (int i = 0; i < Lasers.Count; i++)
        {
            if (count == i)
            {
                laserScript.DisableLaserCaller(0.05f);
                activeLaser.SetActive(false);
                activeLaser = Lasers [i];
                laserScript = activeLaser.GetComponent <LaserScript> ();
                laserScript.EnableLaser();
                activeLaser.SetActive(true);
            }
        }
    }
예제 #32
0
파일: Game.cs 프로젝트: fdtemp/GameTask
    public static void CreateLaser(Vector3 a, Vector3 b, float t)
    {
        GameObject l;

        if (LaserPool.Count != 0)
        {
            l = LaserPool.Get();
        }
        else
        {
            l = GameObject.Instantiate <GameObject>(Game.LaserPrefab);
        }
        LineRenderer lr = l.GetComponent <LineRenderer>();

        lr.SetVertexCount(2);
        lr.SetWidth(1, 1);
        lr.SetPosition(0, a);
        lr.SetPosition(1, b);
        LaserScript ls = l.GetComponent <LaserScript>();

        ls.AppearTime = t;
        ls.Pool       = LaserPool;
    }
예제 #33
0
	void level1Initial(){
		DestroyTemp();
		
		objPlayer.transform.position = new Vector3(-960,0,-970);
		
		newLaser = (GameObject)Instantiate(ptrScriptVariable.Laser);
		newLaser.tag = "temp";
		newLaserScript = (LaserScript) newLaser.GetComponent( typeof(LaserScript) );
		newLaserScript.setProperty(true,0,true,0,true,0,0,1f,-966.2775f,0,-957.5f,0,0,0);
		
		newLaser = (GameObject)Instantiate(ptrScriptVariable.Laser);
		newLaser.tag = "temp";
		newLaserScript = (LaserScript) newLaser.GetComponent( typeof(LaserScript) );
		newLaserScript.setProperty(true,0,true,0,true,0,0,1f,-953.6655f,0,-955f,0,180,0);
		
		newLaser = (GameObject)Instantiate(ptrScriptVariable.Laser);
		newLaser.tag = "temp";
		newLaserScript = (LaserScript) newLaser.GetComponent( typeof(LaserScript) );
		newLaserScript.setProperty(true,0,true,0,true,0,0,1f,-966.2775f,0,-952.5f,0,0,0);
		
		newLaser = (GameObject)Instantiate(ptrScriptVariable.Laser);
		newLaser.tag = "temp";
		newLaserScript = (LaserScript) newLaser.GetComponent( typeof(LaserScript) );
		newLaserScript.setProperty(true,0,true,0,true,0,0,1f,-953.6655f,0,-950f,0,180,0);
		
		newLaser = (GameObject)Instantiate(ptrScriptVariable.Laser);
		newLaser.tag = "temp";
		newLaserScript = (LaserScript) newLaser.GetComponent( typeof(LaserScript) );
		newLaserScript.setProperty(true,0,true,3,true,5,5,0,-966.2775f,0,-945f,0,0,0);
		
		newLaser = (GameObject)Instantiate(ptrScriptVariable.Laser);
		newLaser.tag = "temp";
		newLaserScript = (LaserScript) newLaser.GetComponent( typeof(LaserScript) );
		newLaserScript.setProperty(true,0,true,3,false,5,5,0,-953.6655f,0,-935f,0,180,0);
		
		newLaser = (GameObject)Instantiate(ptrScriptVariable.Laser);
		newLaser.tag = "temp";
		newLaserScript = (LaserScript) newLaser.GetComponent( typeof(LaserScript) );
		newLaserScript.setProperty(true,0,true,0,false,0,0,0,-974.5f,0,-921.5f,0,315,0);
		
		newLaser = (GameObject)Instantiate(ptrScriptVariable.Laser);
		newLaser.tag = "temp";
		newLaserScript = (LaserScript) newLaser.GetComponent( typeof(LaserScript) );
		newLaserScript.setProperty(true,0,true,0,false,0,0,0,-945.0286f,0,-921.5f,0,225,0);
		
		newLaser = (GameObject)Instantiate(ptrScriptVariable.Laser);
		newLaser.tag = "temp";
		newLaserScript = (LaserScript) newLaser.GetComponent( typeof(LaserScript) );
		newLaserScript.setProperty(true,0,true,0,false,0,0,0,-974.5f,0,-906.1869f,0,45,0);
		
		newLaser = (GameObject)Instantiate(ptrScriptVariable.Laser);
		newLaser.tag = "temp";
		newLaserScript = (LaserScript) newLaser.GetComponent( typeof(LaserScript) );
		newLaserScript.setProperty(true,0,true,0,false,0,0,0,-945.0286f,0,-906.1869f,0,135,0);
		
		newTrashCan = (GameObject)Instantiate(ptrScriptVariable.TrashCan,new Vector3(-962.6769f,0,-926.5178f),Quaternion.identity);
		newTrashCan.tag = "temp";
		newTrashCan = (GameObject)Instantiate(ptrScriptVariable.TrashCan,new Vector3(-957.4157f,0,-926.5178f),Quaternion.identity);
		newTrashCan.tag = "temp";
	}
    // Use this for initialization
    void Start()
    {
        usedMagicAttack = false;
        hpScript = gameObject.GetComponent<HealthScript>();
        lightColor = "White";
        uiScript = (CursorScript) GameObject.Find("Menu Cursor").GetComponent<CursorScript>();
        state = "Standby";
        prevLocation = transform.position;
        speed = 15.0f;
        successfullyAttacked = false;

        attackTimer = 0.0f;

        blackTimer = 0;

        dmgBox = (DamageBoxScript) GameObject.Find ("DamageBox").GetComponent<DamageBoxScript>();

        maxHealth = maxMana = 0.0f;
        maxHealth = GameObject.Find ("Menu Cursor").GetComponent<StatsScript>().GetMaxHP (gameObject.name);
        health = maxHealth;
        maxMana = GameObject.Find ("Menu Cursor").GetComponent<StatsScript>().GetMaxMP (gameObject.name);
        mana = maxMana;

        audioPlayer = gameObject.AddComponent<AudioSource>();
        if (gameObject.name == "Zebulon")
        {
            lasScript = gameObject.GetComponentInChildren<LaserScript>();
            lasScript.Hide();
        }
        cachedForward = transform.forward;
    }
예제 #35
0
    void Start()
    {
        manager = GameObject.Find("Main Camera").GetComponent<NPCManager>();

        characterController = GetComponent<CharacterController>();
        //weaponText = canvas.GetComponentInChildren<Text>();

        shield = gameObject.GetComponentInChildren<ShieldScript>();
        laser = gameObject.GetComponentInChildren<LaserScript>();
        charge = gameObject.GetComponentInChildren<ChargeScript>();
        bomb = gameObject.GetComponentInChildren<BombScript>();

        laserSound = gameObject.GetComponent<AudioSource>();

        cameraScript = GameObject.Find("Main Camera").GetComponent<CameraFollow>();

        futurePosition = GetComponentInChildren<FuturePositionScript>().transform;

        if (Input.GetJoystickNames().Length > 0)
        {
            isControllerConnected = true;
        }

        transform.position = spawnPoint;

        if (GameObject.Find("PlayerUI"))
        {
            ui = GameObject.Find("PlayerUI").GetComponent<PlayerUI>();
        }
    }
예제 #36
0
	void level6Initial(){
		DestroyTemp();	
		
		objPlayer.transform.position = new Vector3(-966,0,-298);
		
		newLaser = (GameObject)Instantiate(ptrScriptVariable.Laser);
		newLaser.tag = "temp";
		newLaserScript = (LaserScript) newLaser.GetComponent( typeof(LaserScript) );
		newLaserScript.setProperty(false,0,false,0,false,0,0,25,-966,0,-280,0,90,0);
		
		newLaser = (GameObject)Instantiate(ptrScriptVariable.Laser);
		newLaser.tag = "temp";
		newLaserScript = (LaserScript) newLaser.GetComponent( typeof(LaserScript) );
		newLaserScript.setProperty(false,1,false,0,false,0,0,25,-962,0,-280,0,90,0);
		
		newLaser = (GameObject)Instantiate(ptrScriptVariable.Laser);
		newLaser.tag = "temp";
		newLaserScript = (LaserScript) newLaser.GetComponent( typeof(LaserScript) );
		newLaserScript.setProperty(false,2,false,0,false,0,0,25,-958,0,-280,0,90,0);
		
		newLaser = (GameObject)Instantiate(ptrScriptVariable.Laser);
		newLaser.tag = "temp";
		newLaserScript = (LaserScript) newLaser.GetComponent( typeof(LaserScript) );
		newLaserScript.setProperty(false,3,false,0,false,0,0,25,-954,0,-280,0,90,0);
		
		newLaser = (GameObject)Instantiate(ptrScriptVariable.Laser);
		newLaser.tag = "temp";
		newLaserScript = (LaserScript) newLaser.GetComponent( typeof(LaserScript) );
		newLaserScript.setProperty(false,4,false,0,false,0,0,25,-950,0,-280,0,90,0);
		
		newLaser = (GameObject)Instantiate(ptrScriptVariable.Laser);
		newLaser.tag = "temp";
		newLaserScript = (LaserScript) newLaser.GetComponent( typeof(LaserScript) );
		newLaserScript.setProperty(false,5,false,0,false,0,0,25,-946,0,-280,0,90,0);
		
		newLaser = (GameObject)Instantiate(ptrScriptVariable.Laser);
		newLaser.tag = "temp";
		newLaserScript = (LaserScript) newLaser.GetComponent( typeof(LaserScript) );
		newLaserScript.setProperty(false,6,false,0,false,0,0,25,-942,0,-280,0,90,0);
		
		newLaser = (GameObject)Instantiate(ptrScriptVariable.Laser);
		newLaser.tag = "temp";
		newLaserScript = (LaserScript) newLaser.GetComponent( typeof(LaserScript) );
		newLaserScript.setProperty(false,7,false,0,false,0,0,25,-938,0,-280,0,90,0);
		
		newLaser = (GameObject)Instantiate(ptrScriptVariable.Laser);
		newLaser.tag = "temp";
		newLaserScript = (LaserScript) newLaser.GetComponent( typeof(LaserScript) );
		newLaserScript.setProperty(false,8,false,0,false,0,0,25,-936,0,-282,0,180,0);
		
		newLaser = (GameObject)Instantiate(ptrScriptVariable.Laser);
		newLaser.tag = "temp";
		newLaserScript = (LaserScript) newLaser.GetComponent( typeof(LaserScript) );
		newLaserScript.setProperty(false,9,false,0,false,0,0,25,-936,0,-286,0,180,0);
		
		newLaser = (GameObject)Instantiate(ptrScriptVariable.Laser);
		newLaser.tag = "temp";
		newLaserScript = (LaserScript) newLaser.GetComponent( typeof(LaserScript) );
		newLaserScript.setProperty(false,10,false,0,false,0,0,25,-936,0,-290,0,180,0);
		
		newLaser = (GameObject)Instantiate(ptrScriptVariable.Laser);
		newLaser.tag = "temp";
		newLaserScript = (LaserScript) newLaser.GetComponent( typeof(LaserScript) );
		newLaserScript.setProperty(false,11,false,0,false,0,0,25,-936,0,-294,0,180,0);
		
		newLaser = (GameObject)Instantiate(ptrScriptVariable.Laser);
		newLaser.tag = "temp";
		newLaserScript = (LaserScript) newLaser.GetComponent( typeof(LaserScript) );
		newLaserScript.setProperty(false,12,false,0,false,0,0,25,-936,0,-298,0,180,0);
		
		newLaser = (GameObject)Instantiate(ptrScriptVariable.Laser);
		newLaser.tag = "temp";
		newLaserScript = (LaserScript) newLaser.GetComponent( typeof(LaserScript) );
		newLaserScript.setProperty(false,13,false,0,false,0,0,25,-938,0,-300,0,270,0);
		
		newLaser = (GameObject)Instantiate(ptrScriptVariable.Laser);
		newLaser.tag = "temp";
		newLaserScript = (LaserScript) newLaser.GetComponent( typeof(LaserScript) );
		newLaserScript.setProperty(false,14,false,0,false,0,0,25,-942,0,-300,0,270,0);
		
		newLaser = (GameObject)Instantiate(ptrScriptVariable.Laser);
		newLaser.tag = "temp";
		newLaserScript = (LaserScript) newLaser.GetComponent( typeof(LaserScript) );
		newLaserScript.setProperty(false,15,false,0,false,0,0,25,-946,0,-300,0,270,0);
		
		newLaser = (GameObject)Instantiate(ptrScriptVariable.Laser);
		newLaser.tag = "temp";
		newLaserScript = (LaserScript) newLaser.GetComponent( typeof(LaserScript) );
		newLaserScript.setProperty(false,16,false,0,false,0,0,25,-950,0,-300,0,270,0);
		
		newLaser = (GameObject)Instantiate(ptrScriptVariable.Laser);
		newLaser.tag = "temp";
		newLaserScript = (LaserScript) newLaser.GetComponent( typeof(LaserScript) );
		newLaserScript.setProperty(false,17,false,0,false,0,0,25,-954,0,-300,0,270,0);
		
		newLaser = (GameObject)Instantiate(ptrScriptVariable.Laser);
		newLaser.tag = "temp";
		newLaserScript = (LaserScript) newLaser.GetComponent( typeof(LaserScript) );
		newLaserScript.setProperty(false,18,false,0,false,0,0,25,-958,0,-300,0,270,0);
		
		newLaser = (GameObject)Instantiate(ptrScriptVariable.Laser);
		newLaser.tag = "temp";
		newLaserScript = (LaserScript) newLaser.GetComponent( typeof(LaserScript) );
		newLaserScript.setProperty(false,19,false,0,false,0,0,25,-962,0,-300,0,270,0);
		
		newLaser = (GameObject)Instantiate(ptrScriptVariable.Laser);
		newLaser.tag = "temp";
		newLaserScript = (LaserScript) newLaser.GetComponent( typeof(LaserScript) );
		newLaserScript.setProperty(false,20,false,0,false,0,0,25,-966,0,-300,0,270,0);
		
		newLaser = (GameObject)Instantiate(ptrScriptVariable.Laser);
		newLaser.tag = "temp";
		newLaserScript = (LaserScript) newLaser.GetComponent( typeof(LaserScript) );
		newLaserScript.setProperty(false,21,false,0,false,0,0,25,-968,0,-298,0,0,0);
		
		newLaser = (GameObject)Instantiate(ptrScriptVariable.Laser);
		newLaser.tag = "temp";
		newLaserScript = (LaserScript) newLaser.GetComponent( typeof(LaserScript) );
		newLaserScript.setProperty(false,22,false,0,false,0,0,25,-968,0,-294,0,0,0);
		
		newLaser = (GameObject)Instantiate(ptrScriptVariable.Laser);
		newLaser.tag = "temp";
		newLaserScript = (LaserScript) newLaser.GetComponent( typeof(LaserScript) );
		newLaserScript.setProperty(false,23,false,0,false,0,0,25,-968,0,-290,0,0,0);
		
		newLaser = (GameObject)Instantiate(ptrScriptVariable.Laser);
		newLaser.tag = "temp";
		newLaserScript = (LaserScript) newLaser.GetComponent( typeof(LaserScript) );
		newLaserScript.setProperty(false,24,false,0,false,0,0,25,-968,0,-286,0,0,0);
		
		newLaser = (GameObject)Instantiate(ptrScriptVariable.Laser);
		newLaser.tag = "temp";
		newLaserScript = (LaserScript) newLaser.GetComponent( typeof(LaserScript) );
		newLaserScript.setProperty(false,25,false,0,false,0,0,25,-968,0,-282,0,0,0);
		
	}