예제 #1
0
    void Start()
    {
        this.life = this.maxLife;

        GameObjectBundle gob = GameObject.Find("GameMaster").GetComponent <GameObjectBundle> ();

        this.col = (BoxCollider)this.GetComponent <Collider>();

        this.healthBar = Instantiate(
            gob.HealthBar,
            new Vector3(
                this.transform.position.x + this.healthBarPos.x,
                gob.HealthBar.transform.position.y,
                this.transform.position.z + this.healthBarPos.y
                ),
            new Quaternion()
            );
        this.healthBar.transform.rotation = gob.HealthBar.transform.rotation;
        this.helthBarOriginalRotation     = this.healthBar.transform.rotation;
        this.healthBar.transform.SetParent(this.transform);
        this.healthBar.name          = this.transform.name + "_" + gob.HealthBar.name;
        this.healthBarVisibilityTime = 0f;
        StartCoroutine("healthBarFade");

        this.hitFx = gob.HitFx;
    }
    public void explode(Transform subject)
    {
        GameObjectBundle gob       = this.gm.GetComponent <GameObjectBundle> ();
        GameObject       explosion = gob.Explosion;
        GameObject       e         = Instantiate(explosion, subject.position, subject.rotation);

        Destroy(e, this.explosionTime);
    }
    void Start()
    {
        this.transform.position = new Vector3(
            this.transform.position.x,
            this.transform.position.y + (posY - this.transform.position.y),
            this.transform.position.z
            );

        this.mainCamera = Camera.main.transform;
        GameObjectBundle gob = GameObject.Find("GameMaster").GetComponent <GameObjectBundle> ();

        this.fx = gob.ShootFire;

        StartCoroutine("shoot");
    }
    public void explode(Vector2 pos)
    {
        GameObjectBundle gob       = this.gm.GetComponent <GameObjectBundle> ();
        GameObject       explosion = gob.Explosion;
        GameObject       e         = Instantiate(
            explosion,
            new Vector3(
                this.transform.position.x + pos.x,
                this.transform.position.y,
                this.transform.position.z + pos.y
                ),
            this.transform.rotation
            );

        Destroy(e, 2f);
    }
    void Start()
    {
        this.gm = GameObject.Find("GameMaster");
        GameObjectBundle gob    = this.gm.GetComponent <GameObjectBundle> ();
        GameObject       player = gob.Player;

        if (this.lookAtPlayer)
        {
            LookAt lookAt = this.GetComponent <LookAt> ();
            if (lookAt)
            {
                lookAt.target  = player;
                lookAt.freezeY = true;
            }
        }
    }