void Start() { robotSound = GetComponentInChildren <RobotSound>(); ani = GetComponentInChildren <Animator>(); discoLightRoot = transform.Find("DiscoLightRoot"); discoLightRoot.DORotate(Vector3.up * 360, 3, RotateMode.LocalAxisAdd).SetLoops(-1).SetEase(Ease.Linear); discoLightRoot.transform.parent = null;//Move to root , since discoLight will causes rigidbody broken. MyHelpNode.FindTransform(transform, "RobotHeadSpotlight", out headSpotlight); rb = GetComponent <Rigidbody>(); }
public void ShowUp(Vector3 camPos, Vector3 camForward) { robotSound = GetComponentInChildren <RobotSound>(); ani = GetComponentInChildren <Animator>(); ani.SetTrigger("ShowUp"); Vector3 pos = camPos + camForward * 2; pos.y += 1; transform.position = pos; //transform.LookAt(camPos, Vector3.up); transform.up = Vector3.up; robotSound.PlaySound("ShowUpSound"); }
private void Awake() { IsMoving = false; sound = GetComponent<RobotSound>(); sound.PlayMajorSound(RobotSound.MajorSoundType.Idle); bodyMatInst = Material.Instantiate(bodyMat); faceMatInst = Material.Instantiate(faceMat); MeshRenderer[] renderers = GetComponentsInChildren<MeshRenderer>(); foreach (MeshRenderer r in renderers) { if (r.gameObject.name == "face") r.material = faceMatInst; else r.material = bodyMatInst; } hintBubble.enabled = false; hintBubble2.enabled = false; //ChangeExpression(Expression.Smile); }