public void saveCurrentPlayerState(playerModel player) { using (IDbConnection cnn = new SQLiteConnection(loadConnectionString())) { cnn.Open(); cnn.Execute("INSERT INTO playerPosition (x, y) VALUES (@x, @y)", player); Console.WriteLine($"{player.x}, {player.y}, {player}"); } }
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)); }
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); }
// Use this for initialization public void init(playerModel owner) { this.name = "Bullet"; speed = 7; playerType = owner.getType(); clock = 0f; var modelObject = GameObject.CreatePrimitive(PrimitiveType.Quad); // Create a quad object for holding the gem texture. model = modelObject.AddComponent <BulletModel>(); // Add a marbleModel script to control visuals of the gem. model.init(this); BoxCollider2D playerbody = gameObject.AddComponent <BoxCollider2D> (); playerbody.isTrigger = true; }
public playerModel m; // A pointer to the manager (not needed here, but potentially useful in general). public void init(playerModel m, float x, float y, int angle) { this.m = m; this.movex = x; this.movey = y; this.name = "BulletModel"; 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.name = "BulletModel"; playerbody.isTrigger = true; model = modelObject.AddComponent <bulletModel>(); // Add an enemyModel script to control visuals of the gem. model.init(this, x, y, angle); }
// Use this for initialization public void init(playerModel 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 <BulletModel>(); // 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); } }
public playerControl(int id, playerModel model) { this.model = model; this.playerId = id; }
/// <summary> /// 设置人物的模型数据类 /// </summary> /// <param name="model"></param> public void setPlayerModel(playerModel model) { this.model = model; }