public void Attack(bool IsEnemy) { if (CanAttack) { blastCooldown = blastingRate; Transform blastTransform = Instantiate(blastPrefab, transform.position, transform.rotation).transform; blastTransform.position = transform.position; if (transform.parent) { blastTransform.SetParent(transform.parent); } BlastScript blast = blastTransform.gameObject.GetComponent <BlastScript>(); if (blast != null) { blast.isEnemyBlast = IsEnemy; } // On saisit la direction pour le mouvement AutoMoveAndRotate move = blastTransform.gameObject.GetComponent <AutoMoveAndRotate>(); if (move != null) { move.moveUnitsPerSecond.value = Vector3.right * blastSpeed; } } }
// public bool respawnItemAtResume; void Awake() { if (RotatioDelay > 0) { rotateAndMove = GetComponent <AutoMoveAndRotate>(); rotateAndMove.enabled = false; Invoke("ActivateRotation", RotatioDelay); } }
// Update is called once per frame void Update() { if (Input.GetMouseButton(0)) { RaycastHit hitInfo; if (Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hitInfo)) { globe = hitInfo.transform.GetComponent <DataGlobe>(); if (globe != null) { autoMover = globe.gameObject.GetComponent <AutoMoveAndRotate>(); isGrabbing = true; } else { isGrabbing = false; } } else { isGrabbing = false; } } else { isGrabbing = false; } if (isGrabbing) { resumeTime = 0f; autoMover.enabled = false; rotationX = globe.transform.eulerAngles.y - (Input.GetAxis("Mouse X") * rotationSpeed * Time.deltaTime); globe.transform.eulerAngles = new Vector3(0, rotationX, 0); } else if (globe != null && autoMover != null) { if (resumeTime >= resumeDelay) { rotationX = 0; //autoMover.enabled = true; resumeTime = 0f; } else { resumeTime += Time.deltaTime; } } }
void Awake() { if (GemID == 0) { Destroy(gameObject); } if (RotatioDelay > 0) { rotateAndMove = GetComponent <AutoMoveAndRotate>(); rotateAndMove.enabled = false; Invoke("ActivateRotation", RotatioDelay); } GetComponent <ObjectNote>().Text = GemID.ToString(); }
void FindComponents() { MoveAndRotateScript = GetComponent <AutoMoveAndRotate> (); playerControllerScript = GameObject.Find("Player").GetComponent <PlayerController>(); camShakeScript = Camera.main.GetComponent <CameraShake> (); ComboAudio[0] = GameObject.FindGameObjectWithTag("ComboAudioZero").GetComponent <AudioSource>(); ComboAudio[1] = GameObject.FindGameObjectWithTag("ComboAudioOne").GetComponent <AudioSource>(); ComboAudio[2] = GameObject.FindGameObjectWithTag("ComboAudioTwo").GetComponent <AudioSource>(); ComboAudio[3] = GameObject.FindGameObjectWithTag("ComboAudioThree").GetComponent <AudioSource>(); ComboAudio[4] = GameObject.FindGameObjectWithTag("ComboAudioFour").GetComponent <AudioSource>(); ComboAudio[5] = GameObject.FindGameObjectWithTag("ComboAudioFive").GetComponent <AudioSource>(); ComboAudio[6] = GameObject.FindGameObjectWithTag("ComboAudioSix").GetComponent <AudioSource>(); ComboAudio[7] = GameObject.FindGameObjectWithTag("ComboAudioSeven").GetComponent <AudioSource>(); ComboAudio[8] = GameObject.FindGameObjectWithTag("ComboAudioEight").GetComponent <AudioSource>(); ComboAudio[9] = GameObject.FindGameObjectWithTag("ComboAudioNine").GetComponent <AudioSource>(); }
void FindComponents() { MoveAndRotateScript = GetComponent<AutoMoveAndRotate> (); playerControllerScript = GameObject.Find ("Player").GetComponent<PlayerController>(); camShakeScript = Camera.main.GetComponent<CameraShake> (); ComboAudio[0] = GameObject.FindGameObjectWithTag ("ComboAudioZero").GetComponent<AudioSource>(); ComboAudio[1] = GameObject.FindGameObjectWithTag ("ComboAudioOne").GetComponent<AudioSource>(); ComboAudio[2] = GameObject.FindGameObjectWithTag ("ComboAudioTwo").GetComponent<AudioSource>(); ComboAudio[3] = GameObject.FindGameObjectWithTag ("ComboAudioThree").GetComponent<AudioSource>(); ComboAudio[4] = GameObject.FindGameObjectWithTag ("ComboAudioFour").GetComponent<AudioSource>(); ComboAudio[5] = GameObject.FindGameObjectWithTag ("ComboAudioFive").GetComponent<AudioSource>(); ComboAudio[6] = GameObject.FindGameObjectWithTag ("ComboAudioSix").GetComponent<AudioSource>(); ComboAudio[7] = GameObject.FindGameObjectWithTag ("ComboAudioSeven").GetComponent<AudioSource>(); ComboAudio[8] = GameObject.FindGameObjectWithTag ("ComboAudioEight").GetComponent<AudioSource>(); ComboAudio[9] = GameObject.FindGameObjectWithTag ("ComboAudioNine").GetComponent<AudioSource>(); }
void Awake() { rotateAndMove = GetComponent <AutoMoveAndRotate>(); if (RotatioDelay > 0) { rotateAndMove.enabled = false; Invoke("ActivateRotation", RotatioDelay); } mainRender = GetComponent <Renderer>(); if (!mainRender) { mainRender = GetComponentInChildren <Renderer>(true); } rotateAndMove.enabled = false; mainRender.enabled = false; }
public void Attack(bool IsEnemy) { if (CanAttack) { BlastCooldown = BlastingRate; Transform BlastTransform = ObjectPool.instance.GetObjectForType(BlastPrefab.name, false).transform; BlastTransform.name = BlastPrefab.name; BlastTransform.transform.parent = transform; BlastTransform.transform.localScale = Vector3.one; BlastTransform.transform.position = transform.position; BlastTransform.transform.rotation = transform.rotation; BlastScript Blast = BlastTransform.gameObject.GetComponent <BlastScript>(); Blast.IsEnemyBlast = IsEnemy; // On saisit la direction pour le mouvement AutoMoveAndRotate Move = BlastTransform.gameObject.GetComponent <AutoMoveAndRotate>(); Move.moveUnitsPerSecond.value = Vector3.right * BlastSpeed; } }
void Awake() { rotateAndMove = GetComponent <AutoMoveAndRotate>(); if (RotatioDelay > 0) { if (rotateAndMove) { rotateAndMove.enabled = false; } } mainRender = GetComponent <Renderer>(); if (!mainRender) { mainRender = GetComponentInChildren <Renderer>(true); } if (!ParticleS) { ParticleS = GetComponentInChildren <ParticleSystem>(true); } rotateAndMove.enabled = false; mainRender.enabled = false; ParticleS.gameObject.SetActive(false); }
void FindComponents() { PlayerControllerScript = GameObject.Find("Player").GetComponent <PlayerController>(); moveScript = GetComponent <AutoMoveAndRotate> (); }
new public void Start() { autoMover = GetComponent <AutoMoveAndRotate>(); }
void FindComponents() { PlayerControllerScript = GameObject.Find ("Player").GetComponent<PlayerController>(); moveScript = GetComponent<AutoMoveAndRotate> (); }