Example #1
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));
        }
Example #2
0
        // Use this for initialization
        public void init(tplayerModel owner)
        {
            print("Created BUllet: " + owner.owner.playerType);
            if (owner.owner.usingcircpowerup == true || owner.owner.tag == "inviscircle")
            {
                if (owner.owner.usingcircpowerup == true)
                {
                    print("With powerup");
                }
                this.name = "SpecialBullet";
            }
            else
            {
                this.name = "Bullet";
            }



            playerType = owner.getType();
            if (owner.owner.m.inSlowDown)
            {
                speed -= 6;
            }

            if (this.playerType == 0)
            {
                speed = 9.5f;
            }
            else if (this.playerType == 1)
            {
                speed = 8f;
            }
            else if (this.playerType == 2)
            {
                speed = 6.5f;
            }

            //speed += 3;

            if (this.name == "SpecialBullet")
            {
                speed -= 1.5f;
            }
            if (owner.owner.m.inSlowDown)
            {
                speed -= 1;
            }


            clock = 0f;

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

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

            BoxCollider2D playerbody = gameObject.AddComponent <BoxCollider2D> ();
            Rigidbody2D   bossRbody  = gameObject.AddComponent <Rigidbody2D> ();

            bossRbody.gravityScale = 0;
            playerbody.isTrigger   = true;
            if (this.name == "Bullet")
            {
                transform.localScale = new Vector3(.3f, 0.8f, 1);
            }
            else
            {
                transform.localScale = new Vector3(.65f, 0.8f, 1);
            }
        }