Esempio n. 1
0
    public void init(int playerType, GameManager m)
    {
        this.usingcircpowerup = false;
        this.playerType       = playerType;
        //this.initHealth = initHealth;
        this.m = m;


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

            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 <playerModel>();                                                       // 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);
        if (this.playerType == 1)
        {
            transform.localScale = new Vector3(1.4f, 1f, 1);
        }
        StartCoroutine(this.playerTimer(this.playerTimeOut));
    }
Esempio n. 2
0
    public void init(int playerType, GameManager m)
    {
        this.playerType = playerType;
        //this.initHealth = initHealth;
        this.m = m;

        var           modelObject = GameObject.CreatePrimitive(PrimitiveType.Quad);     // Create a quad object for holding the gem texture.
        BoxCollider2D playerbody  = gameObject.AddComponent <BoxCollider2D> ();
        Rigidbody2D   playerRbody = gameObject.AddComponent <Rigidbody2D> ();

        playerRbody.gravityScale = 0;
        playerbody.isTrigger     = true;
        model = modelObject.AddComponent <playerModel>();                                                       // Add an playerModel script to control visuals of the gem.
        model.init(playerType, this);
    }