private movements playerCtrl; // Reference to the PlayerControl script. // private HeroVida Alive; //private Animator anim; // Reference to the Animator component. void Awake() { // Setting up the references. //anim = transform.root.gameObject.GetComponent<Animator>(); playerCtrl = transform.root.GetComponent <movements>(); //Alive = GetComponent <HeroVida>(); }
// Update is called once per frame void Update() { timeRemaining -= Time.deltaTime; if (timeRemaining < 0) { timeRemaining = 5f; int x = SendSerial.sendAndReceive("5"); //make 5 later string spriteName = "ts_" + x.ToString(); //Sprite tsSprite = Resources.Load(spriteName, typeof(Sprite)) as Sprite; //GetComponent<SpriteRenderer>().sprite = tsSprite; img.sprite = sprites[x]; print(x + " was just recieved, nice"); if (x == 6 && running == false) { running = true; GameObject theDude = GameObject.Find("Y_Bot"); movements transClass = (movements)theDude.GetComponent(typeof(movements)); transClass.changeTheDude(); } } }
void OnCollisionEnter2D(Collision2D other) { try{ //anim.SetTrigger("Attack"); if (other != null && other.gameObject != null && other.gameObject.tag == "Enemy") { movementScript = other.gameObject.GetComponent<movements>(); movementScript.collision = true; Collider2D collider = other.collider; if(collider.name.Contains("Enemy")) { movementScript.collisionRight = other.gameObject.GetComponent<Rigidbody2D>().position.x > this.gameObject.GetComponent<Rigidbody2D>().position.x; movementScript.collisionUp = other.gameObject.GetComponent<Rigidbody2D>().position.y > this.gameObject.GetComponent<Rigidbody2D>().position.y; } } if(other != null && other.gameObject != null && other.gameObject.tag == "Player") { //Debug.Log("Gerad!!!! movementScript.playerCollision1: " + movementScript.playerCollision); //GameObject player = GameObject.FindGameObjectsWithTag("Player")[0]; //enemyAttributes.Engaged = true; //enemyAttributes.Health -= 10; //if(enemyAttributes.Health <= 0){ // Destroy(enemyAttributes.gameObject); //} //Debug.Log(other.name + ": " + enemyAttributes.Health); } }catch(MissingReferenceException ex){ } /*Vector2 enemyPosition = GetComponent<Rigidbody2D> ().position; float x; float y; if (enemyPosition.x >= other.attachedRigidbody.position.x) { x = -1; } else { x = 1; } if (enemyPosition.y >= other.attachedRigidbody.position.y) { y = -1; } else { y = 1; } Vector2 movement = new Vector3 (x, y); float speed = movements.GetSpeed (); GetComponent<Rigidbody2D> ().velocity = movement * speed; GetComponent<Rigidbody2D> ().position = new Vector2 ( Mathf.Clamp (GetComponent<Rigidbody2D> ().position.x, -5.0f, 5.0f), Mathf.Clamp (GetComponent<Rigidbody2D> ().position.y, -5.0f, 5.0f) );*/ //Debug.Log ("Trigger Hit"); /*if (movements.getEngaged()) { Vector2 movement = new Vector3 (moveHorizontal, moveVertical); GetComponent<Rigidbody2D> ().velocity = movement * speed; }*/ }
// Use this for initialization void Awake() { anime = GetComponent <Animator>(); GunScript = GetComponent <Gun> (); MovementsScript = GetComponent <movements> (); //CheckAlive (); currentHealth = startingHealth; healthSlider.maxValue = startingHealth; healthSlider.value = currentHealth; }
protected GameScene(IntPtr handle) : base(handle) { fetch = new setup1(); data = new fetch_data(); move = new movements(); player1 = new Sprite.Entity(fetch.p1()); sprites = new Sprite[10, 10, 3]; Nextmove = false; //accelx = 0; //accely = 0; Height = Frame.Size.Height; Width = Frame.Size.Width; bg = SKSpriteNode.FromImageNamed("background/background"); player1.spriteNode = SKSpriteNode.FromImageNamed(player1.spritef); //p1 = SKSpriteNode.FromImageNamed("sprites/player/p1front"); }
void Start() { playerScript = player.GetComponent<movements>(); }
void Start() { playerScript = player.GetComponent <movements>(); }
var(movements, state, enemies) = message;
void Start() { CircleCollider2D collider = GetComponent<CircleCollider2D> (); //collider.radius = seperation; //AI_Attributes.Engaged = false; collision = false; movementScript = new movements (); }