コード例 #1
0
ファイル: tBoss.cs プロジェクト: dearlux/PowerOfNumbers
        // Use this for initialization
        public void init(tGameController owner, int type)
        {
            bossType  = type;
            this.name = "Boss";
            m         = owner;

            if (bossType == 1)
            {
                speed           = m.bossSpeed;
                chargeSpeed     = m.bossSpeed * this.chargeMultiplier;
                this.bossHealth = 100;
                var modelObject = GameObject.CreatePrimitive(PrimitiveType.Quad);               // Create a quad object for holding the gem texture.
                model1 = modelObject.AddComponent <tBossModel> ();                              // Add a marbleModel script to control visuals of the gem.
                model1.init(this);
                float z = transform.position.z;
                transform.position = new Vector3(-4f, 0f, z);
                this.bossHit       = m.bossHit;
                this.bossHitX      = m.bossHitX;
                this.bossDead      = m.bossDead;
                BoxCollider2D bossbody  = gameObject.AddComponent <BoxCollider2D> ();
                Rigidbody2D   bossRbody = gameObject.AddComponent <Rigidbody2D> ();
                bossRbody.gravityScale = 0;
                bossbody.isTrigger     = true;
                transform.localScale   = new Vector3(2f, 2f, 1);
            }
            else if (bossType == 2)
            {
                speed           = 1.8f;
                this.speed      = m.bossSpeed;
                this.charge     = false;
                this.flicker    = false;
                chargeSpeed     = m.bossSpeed * this.chargeMultiplier;
                this.bossHealth = 100;
                var modelObject = GameObject.CreatePrimitive(PrimitiveType.Quad);               // Create a quad object for holding the gem texture.
                model2 = modelObject.AddComponent <tBoss2Model>();                              // Add a marbleModel script to control visuals of the gem.
                model2.init(this);

                BoxCollider2D bossbody  = gameObject.AddComponent <BoxCollider2D> ();
                Rigidbody2D   bossRbody = gameObject.AddComponent <Rigidbody2D> ();
                bossRbody.gravityScale = 0;
                bossbody.isTrigger     = true;

                transform.localScale = new Vector3(3f, 3f, 1);

                GameObject  shieldObject = new GameObject();
                tBossShield shield       = shieldObject.AddComponent <tBossShield>();
                shield.init(this);
                shield.transform.position = new Vector3(this.transform.position.x + 3.5f, this.transform.position.y + 2.7f, 0);

                shieldDead    = false;
                this.bossHit  = m.bossHit;
                this.bossHitX = m.bossHitX;
                this.bossDead = m.bossDead;
            }
        }
コード例 #2
0
        // Use this for initialization
        public void init(tGameController m)
        {
            owner       = m;
            this.name   = "EnvVar";
            this.health = 5;

            var modelObject = GameObject.CreatePrimitive(PrimitiveType.Quad);           // Create a quad object for holding the gem texture.

            model = modelObject.AddComponent <tEnvVarModel>();                          // Add a marbleModel script to control visuals of the gem.
            model.init(this);

            BoxCollider2D envbody  = gameObject.AddComponent <BoxCollider2D> ();
            Rigidbody2D   envrbody = gameObject.AddComponent <Rigidbody2D> ();

            envbody.isTrigger     = true;
            envrbody.gravityScale = 0;
            model.offset();
            //transform.localScale = new Vector3 (.35f, .35f, 1);
            //transform.localPosition -= new Vector3(-2f, -2f, 0);
            //this.owner.m.envFolder.Add (this.model.gameObject);
        }
コード例 #3
0
        public void init(int playerType, tGameController m)
        {
            this.usingcircpowerup = false;
            this.playerType       = playerType;
            //this.initHealth = initHealth;
            this.m = m;


            if (this.playerType == 0)
            {
                //triangle

                this.cdA = 8.5f;
            }
            else if (this.playerType == 1)
            {
                //circle

                this.cdA = 8.5f;
            }
            else if (this.playerType == 2)
            {
                //square

                this.cdA = 8.5f;
            }

//		camera = GetComponent<Camera>();
//		camera.clearFlags = CameraClearFlags.SolidColor;
//

            var modelObject = GameObject.CreatePrimitive(PrimitiveType.Quad);           // Create a quad object for holding the gem texture.

            playerbody = gameObject.AddComponent <BoxCollider2D> ();

            Rigidbody2D playerRbody = gameObject.AddComponent <Rigidbody2D> ();

            playerRbody.gravityScale = 0;
            playerbody.isTrigger     = true;
            model = modelObject.AddComponent <tplayerModel>();                                                  // Add an playerModel script to control visuals of the gem.
            model.init(playerType, this);
            this.tag             = "Player";
            transform.localScale = new Vector3(0.75f, 0.75f, 1);

            float z = transform.position.z;

            if (this.playerType != 0)
            {
                if (this.playerType == 1)
                {
                    this.transform.position = new Vector3(3, +0.65f, z);
                }
                else
                {
                    this.transform.position = new Vector3(4, -0.65f, z);
                }
            }
            else
            {
//			float y = transform.position.y;
//			this.transform.position = new Vector3 (2, y, z);
            }

            if (this.playerType == 1)
            {
                transform.localScale = new Vector3(1.4f, 1f, 1);
            }
            StartCoroutine(this.playerTimer(this.playerTimeOut));
        }