private void Start() { playerControls = FindObjectOfType <PlayerControlsCanvas>(); defeat = FindObjectOfType <DefeatScreen>(); options = FindObjectOfType <InGameOptions>(); camera = Camera.main; attackButton = playerControls.AttackButton; jumpButton = playerControls.JumpButton; optionsButton = playerControls.OptionsButton; joystick = playerControls.Joystick; #region Assertions Assert.IsNotNull(rigidbody); Assert.IsNotNull(animator); Assert.IsNotNull(characterSprite); Assert.IsNotNull(joystick); Assert.IsNotNull(jumpButton); Assert.IsNotNull(attackButton); Assert.IsNotNull(optionsButton); Assert.IsNotNull(camera); Assert.IsNotNull(defeat); Assert.IsNotNull(options); Assert.IsNotNull(playerControls); #endregion optionsButton.onClick.AddListener(GoToOptions); jumpButton.onClick.AddListener(Jump); attackButton.onClick.AddListener(Attack); isDead = false; }
private void Start() { Joystick = GameObject.Find("#Joystick").GetComponent <bl_Joystick>(); if (Joystick == null) { Debug.LogWarning("Joystick není správně nastaven"); } model = this.transform.GetChild(0).gameObject; if (model == null) { Debug.LogWarning("Model není správně nastaven"); } animator = GetComponentInChildren <Animator>(); if (animator == null) { Debug.LogWarning("Animator není správně nastaven"); } rb = this.GetComponent <Rigidbody2D>(); if (rb == null) { Debug.LogWarning("Rigidbody není správně nastaven"); } HardBoundaries hb = GameObject.Find("#Units").GetComponent <HardBoundaries>(); if (hb == null) { Debug.LogWarning("Jednotka nemá určené hard boundaries"); } else { hb.AddManualy(this.transform); } }
// Start is called before the first frame update void Start() { startSpeed = speed; isFuelFreeze = false; Joystick = GameObject.FindWithTag("Joystick").GetComponent <bl_Joystick>(); soplo = transform.GetComponentsInChildren <Transform>()[1]; textScore = GameObject.FindWithTag("Canvas").GetComponentsInChildren <Text>()[0]; textSpeed = GameObject.FindWithTag("Canvas").GetComponentsInChildren <Text>()[1]; textLevel = GameObject.FindWithTag("Canvas").GetComponentsInChildren <Text>()[2]; textResource = GameObject.FindWithTag("Canvas").GetComponentsInChildren <Text>()[3]; textAddScore = GameObject.FindWithTag("Canvas").GetComponentsInChildren <Text>()[6]; fuelProgress = GameObject.FindWithTag("Canvas").GetComponentsInChildren <Image>()[0]; rocket_camera = Camera.main; coinSound = textAddScore.GetComponent <AudioSource>(); resourceSound = textResource.GetComponent <AudioSource>(); jumpSound = textSpeed.GetComponent <AudioSource>(); loopMusic = textLevel.GetComponent <AudioSource>(); gameOverSound = fuelProgress.GetComponent <AudioSource>(); if (PlayerPrefs.GetString("Sound") == "On") { loopMusic.loop = true; loopMusic.Play(); } fly = new Vector3(0, speed, 0); childRocket = transform.GetComponentsInChildren <Transform>()[1]; rbRocket = GetComponent <Rigidbody>(); currentLevel = 255; boost = 1; }
void Start() { anim = GetComponent <Animator>(); body = GetComponent <Rigidbody>(); joystick = FindObjectOfType <bl_Joystick>(); // Add on Click event to existing button button = GameObject.Find("Jump").GetComponent <Button>(); button.onClick.AddListener(Jump); }
//private string username; // Use this for initialization void Start() { rb2d = GetComponent <Rigidbody2D>(); joystick = FindObjectOfType <bl_Joystick>(); moveSync = GetComponent <PlayerMoveSync>(); //username = GetComponentInChildren<TextMesh>().text; player = GetComponent <Renderer>(); if (player.material.color == Color.green) { isLocalPlayer = true; } }
// Use this for initialization void Start() { joystick = GameObject.Find("Joystick"); joystickscript = joystick.GetComponent <bl_Joystick> (); canvas = GameObject.Find("Canvas"); recttransform = joystick.GetComponent <RectTransform> (); canvasrect = canvas.GetComponent <RectTransform> (); firstpos = recttransform.anchoredPosition; }
void Start() { touchController = FindObjectsOfType <bl_Joystick>(); if (touchController [0].name.StartsWith("MJoystick")) { moveController = touchController [0].GetComponent <bl_Joystick> (); attackController = touchController [1].GetComponent <bl_Joystick> (); } else if (touchController [0].name.StartsWith("AJoystick")) { moveController = touchController[1].GetComponent <bl_Joystick> (); attackController = touchController[0].GetComponent <bl_Joystick> (); } }
private void Start() { //UNIT INICIALIZATION Joystick = GameObject.Find("#Joystick").GetComponent <bl_Joystick>(); if (Joystick == null) { Debug.LogWarning("Joystick není správně nastaven"); } model = this.transform.GetChild(0).gameObject; if (model == null) { Debug.LogWarning("Model není správně nastaven"); } animator = GetComponentInChildren <Animator>(); if (animator == null) { Debug.LogWarning("Animator není správně nastaven"); } rb = this.GetComponent <Rigidbody2D>(); if (rb == null) { Debug.LogWarning("Rigidbody není správně nastaven"); } HardBoundaries hb = GameObject.Find("#Units").GetComponent <HardBoundaries>(); if (hb == null) { Debug.LogWarning("Jednotka nemá určené hard boundaries"); } else { hb.AddManualy(this.transform); } //BOIDS INICIALIZATION this.gameObject.name = Random.Range(0, 10000000) + " " + this.gameObject.name; //unique name for diferentiation from self float xv = Random.Range(-boundaries.x, boundaries.x); float yv = Random.Range(-boundaries.y, boundaries.y); velocity = new Vector2(xv, yv).normalized; //this.name = "Boid" + Random.Range(0, 1000000); //units has their own naming convention //float x = Random.Range(-boundaries.x, boundaries.x); //unit is given fixed initial position //float y = Random.Range(-boundaries.y, boundaries.y); //unit is given fixed initial position //this.transform.position = new Vector2(x, y); }
/// <summary> /// /// </summary> void Start() { if (instance == null) { instance = this; } else if (instance == this) { Destroy(gameObject); } if (StickRect == null) { Debug.LogError("Please add the stick for joystick work!."); this.enabled = false; return; } if (transform.root.GetComponent <Canvas>() != null) { m_Canvas = transform.root.GetComponent <Canvas>(); } else if (transform.root.GetComponentInChildren <Canvas>() != null) { m_Canvas = transform.root.GetComponentInChildren <Canvas>(); } else { Debug.LogError("Required at lest one canvas for joystick work.!"); this.enabled = false; return; } //Get the default area of joystick DeathArea = CenterReference.position; diff = CenterReference.position.magnitude; PressScaleVector = new Vector3(OnPressScale, OnPressScale, OnPressScale); if (GetComponent <Image>() != null) { backImage = GetComponent <Image>(); stickImage = StickRect.GetComponent <Image>(); backImage.CrossFadeColor(NormalColor, 0.1f, true, true); stickImage.CrossFadeColor(NormalColor, 0.1f, true, true); } }
/// <summary> /// /// </summary> protected override void Awake() { if (!photonView.IsMine) { return; } base.Awake(); m_Transform = transform; m_CharacterController = GetComponent <CharacterController>(); GunManager = GetComponentInChildren <bl_GunManager>(); DamageManager = GetComponent <bl_PlayerDamageManager>(); #if MFPSM Joystick = FindObjectOfType <bl_Joystick>(); #endif defaultCameraRPosition = CameraRoot.localPosition; m_Jumping = false; m_AudioSource = gameObject.AddComponent <AudioSource>(); m_AudioSource.volume = FootStepVolume; m_MouseLook.Init(m_Transform, HeatRoot, GunManager); lastJumpTime = Time.time; RunFov = 0; }
public void UpdateActiveJoystick(ScreenOrientation orientation) { joystick = UIManager.instance.activeElements.joystickElements.joystick; }
// Start is called before the first frame update void Start() { // vieDuJoueur = GetComponent<VieDuJoueur>(); Cc = GetComponent <CharacterController>(); joystick = FindObjectOfType <bl_Joystick>(); }
void Start() { this.animator = GetComponent <Animator>(); FloatingJoystick = FindObjectOfType <FloatingJoystick>(); // 이동 bl_Joystick = FindObjectOfType <bl_Joystick>(); //공격 }
// Use this for initialization void Start() { Joystick = GameObject.Find("Joystick").GetComponent <bl_Joystick>(); rb = this.GetComponent <Rigidbody>(); spawn = transform.position; }
//public Animator anim; // Start is called before the first frame update void Start() { joystick = FindObjectOfType <bl_Joystick>(); }