// Start is called before the first frame update void Start() { areaOfEffect = this.transform.GetComponent <Collider>(); anim = this.transform.GetComponent <Animator>(); ted = FindObjectOfType <Teddy>(); foreach (Light lite in lights) { lite.enabled = false; } engineAudio.loop = true; scramblingAudio.loop = true; if (strikePlaneFlyingNoise) { engineAudio.clip = strikePlaneFlyingNoise; } if (scramblingNoise) { scramblingAudio.clip = scramblingNoise; } StrikeState = StrikeMode.Idle; isAvailable = true; isScrambling = false; }
private void Awake() { base.Awake(); switch (itemType) { case Type.Utility: item = new Utility(sprite, itemName); break; case Type.Key: item = new Key(sprite, doorForTheKey); break; case Type.Battery: item = new Battery(); break; case Type.Lamp: item = new LampItem(); break; case Type.Teddy: item = new Teddy(); break; } _emiter = gameObject.AddComponent <SoundEmiter>(); _emiter.SetNoiseEmited(NoiseType.Search); }
void Start() { if (debug) { var points = LocalStorage.LoadList <Vector2>(fileName + ".json"); teddy = new Teddy(points); contour = BuildContourSegments(teddy.triangulation); GetComponent <MeshFilter>().sharedMesh = teddy.Build(MeshSmoothingMethod.HC, smoothingTimes, smoothingAlpha, smoothingBeta); } }
// Start is called before the first frame update void Start() { agent = this.GetComponent <NavMeshAgent>(); rigid = this.GetComponent <Rigidbody>(); anim = this.GetComponent <Animator>(); ted = FindObjectOfType <Teddy>(); tedBody = FindObjectOfType <BodyCam>(); sight = viewFinder.GetComponent <viewCylinder>(); badge = GetComponentInChildren <ID>(); camControl = FindObjectOfType <CameraMaster>(); initialMotivation = motivationLevel; initialCuriosity = curiosityLevel; initialAlert = alertLevel; initialThreat = threatLevel; initialFear = fearLevel; initialFriendliness = friendlinessLevel; initialHumor = humorLevel; if (this.transform.Find("Chatter") != null) { speech = this.transform.Find("Chatter").GetComponent <Chatter>(); } numOfFriends = friends.Length; friendAI = new CyclopsAI[numOfFriends]; for (int i = 0; i < numOfFriends; i++) { friendAI[i] = friends[i].GetComponent <CyclopsAI>(); } contacted = false; conversationStarted = false; waypointIndex = Random.Range(0, waypoints.Length - 1); targetLastKnownLocation = target.position; //alertMultiplier = 10; timeStartAttack = -100; lookTimerStart = 0; lookTimer = Random.Range(lookTimerMin, lookTimerMax) + lookTimerAnimationDelay; hitTed = false; animResumeSpeed = 0; behavior = State.Idle; gotPinched = false; //agent.autoRepath = true; }
// Start is called before the first frame update void Start() { camMaster = FindObjectOfType <CameraMaster>(); bCam = FindObjectOfType <BodyCam>(); ted = FindObjectOfType <Teddy>(); rightEye = FindObjectOfType <TeddyRightEye>(); fearMeter = FindObjectOfType <Fear>(); HideMeshesAndColliders(); SetTint(); }
// Use this for initialization void Start() { ted = FindObjectOfType <Teddy>(); cam = GameObject.Find("LeftEyeCam"); //rigid = this.GetComponent<Rigidbody>(); leftEyeActive = false; // Left eye starts inactive leftEyeLock = true; // Left eye starts locked (really??) tedTrack = false; // Ted lock-on initialized to off //rigid.velocity = Vector3.zero; //rigid.angularVelocity = Vector3.zero; sixDOF = false; // Non-6dof on start leftLight.enabled = false; // Eye light off on start }
// Start is called before the first frame update void Start() { agent = this.GetComponent <NavMeshAgent>(); rigid = this.GetComponent <Rigidbody>(); anim = this.GetComponent <Animator>(); ted = FindObjectOfType <Teddy>(); tedBody = FindObjectOfType <BodyCam>(); //sight = viewFinder.GetComponent<viewCylinder>(); badge = GetComponentInChildren <ID>(); camControl = FindObjectOfType <CameraMaster>(); initialMotivation = motivationLevel; initialCuriosity = curiosityLevel; initialAlert = alertLevel; initialThreat = threatLevel; initialFear = fearLevel; initialFriendliness = friendlinessLevel; initialHumor = humorLevel; if (this.transform.Find("Chatter") != null) { speech = this.transform.Find("Chatter").GetComponent <Chatter>(); } contacted = false; conversationStarted = false; waypointIndex = Random.Range(0, waypoints.Length - 1); targetLastKnownLocation = target.position; //alertMultiplier = 10; timeStartAttack = -100; lookTimerStart = 0; lookTimer = Random.Range(lookTimerMin, lookTimerMax) + lookTimerAnimationDelay; isLooking = false; hitTed = false; animResumeSpeed = 0; refFakeTedFadeTime = Time.time; DeactivateFakeTed(); behavior = State.Idle; }
//-------------------------------------------------------------------------------------- // GrenadeExplode: Finds all colliders in the m_fExplosionRadius and calls damage functions, // and knockback in the Soldiers case. // //-------------------------------------------------------------------------------------- private void GrenadeExplode() { // Collect all possible colliders Collider[] aSoldierColliders = Physics.OverlapSphere(transform.position, m_fSoldierExplosionRadius, m_lmUnitMask); Collider[] aTeddyColliders = Physics.OverlapSphere(transform.position, m_fTeddyExplosionRadius, m_lmTeddyMask); for (int i = 0; i < aSoldierColliders.Length; i++) { Rigidbody rbTarget = aSoldierColliders[i].GetComponent <Rigidbody>(); //if it does not have a rigidbody if (!rbTarget) { continue; } if (!Physics.Linecast(transform.position, rbTarget.position, m_lmEnvironmentMask)) { SoldierActor gtarget = rbTarget.GetComponent <SoldierActor>(); // Soldier will take damage based on position (See CalculateDamge function below) gtarget.TakeDamage(CalculateDamage(aSoldierColliders[i].transform.position, m_fSoldierExplosionRadius)); // add explosive force for knockback // NOTE: May be replaced with a non-rigidbody knockback if (CalculateDamage(aSoldierColliders[i].transform.position, m_fSoldierExplosionRadius) > 0) { rbTarget.AddExplosionForce(m_ExplosionForce, transform.position, m_fSoldierExplosionRadius, 0.0f, ForceMode.Impulse); } } } for (int i = 0; i < aTeddyColliders.Length; i++) { Rigidbody rbTarget = aTeddyColliders[i].GetComponent <Rigidbody>(); //if it does not have a rigidbody if (!rbTarget) { continue; } Teddy gtarget = rbTarget.GetComponent <Teddy>(); // Teddy will take damage based on position (See CalculateDamge function below) gtarget.TakeDamage(CalculateDamage(aTeddyColliders[i].transform.position, m_fTeddyExplosionRadius)); } }
// Use this for initialization void Start() { ted = FindObjectOfType <Teddy>(); tedHead = FindObjectOfType <TeddyHead>(); //dave = FindObjectOfType<Dave>(); camMaster = FindObjectOfType <CameraMaster>(); cam = GameObject.Find("RightEyeCam"); bCam = FindObjectOfType <BodyCam>(); bCamCamera = FindObjectOfType <BodyCam>().GetComponent <Camera>(); leftEye = FindObjectOfType <TeddyLeftEye>(); scanner = FindObjectOfType <InfoScan>(); scanText = scanner.GetComponent <Text>(); rigid = this.GetComponent <Rigidbody>(); coll = this.GetComponent <Collider>(); commsControl = FindObjectOfType <CommsController>(); toolSelect = FindObjectOfType <ToolSelector>(); rightEyeActive = false; // Right eye starts inactive rightEyeLock = false; // Right eye starts locked (really??) tedTrack = false; //rigid.velocity = Vector3.zero; //rigid.angularVelocity = Vector3.zero; sixDOF = false; // Non-6dof on start rightLight.enabled = false; // Eye light off on start lockIndicator.enabled = true; sixDOFIndicator.enabled = true; scanStart = 0; storedSpeed = rightEyeSpeed; scanObject = null; previousTargetedID = null; hostID = ted.transform.GetComponent <IDCharacter>(); targetedGhost = null; targetedSpeech = null; targetedAI = null; targetedAudio = null; targetInfoCleared = false; scanFrom = null; }
private Quaternion returnRotLeft, returnRotRight, initialRotBody; // For resetting rotation void Start() { view = FindObjectOfType <BodyCam>(); ted = FindObjectOfType <Teddy>(); anim = ted.GetComponent <Animator>(); rigid = ted.GetComponent <Rigidbody>(); leftEye = FindObjectOfType <TeddyLeftEye>(); rightEye = FindObjectOfType <TeddyRightEye>(); leftEyeColl = leftEye.GetComponent <Collider>(); rightEyeColl = rightEye.GetComponent <Collider>(); leftEyeRigid = leftEye.GetComponent <Rigidbody>(); rightEyeRigid = rightEye.GetComponent <Rigidbody>(); headd = GameObject.Find("head"); mainOverlay.enabled = false; // mainOverlay is used for special screens, like loading, static, and jamming; off at start topRightInsert.enabled = false; // Picture within picture is off at start leftEyeColl.enabled = false; rightEyeColl.enabled = false; leftEyeRigid.isKinematic = true; rightEyeRigid.isKinematic = true; view.bodyCamActive = true; leftEyeLodged = true; // Eyes lodged at start rightEyeLodged = true; // leftEyeTransitioning = false; // Eyes not in process of lodging/dislodging at start rightEyeTransitioning = false; // jammed = false; // No jamming at start jamView = false; // clearView = true; // initialPosBody = view.transform.localPosition; // Set initial positions for body and eyes initialPosLeft = leftEye.transform.localPosition; // initialPosRight = rightEye.transform.localPosition; // initialRotBody = view.transform.localRotation; // Set initial rotations for body and eyes returnRotLeft = leftEye.transform.localRotation; // returnRotRight = rightEye.transform.localRotation; // Debug.Log(view.transform.localEulerAngles); // Troubleshoot eye rotation--what is the initial orientation, for reference? }
// Use this for initialization void Start() { camMaster = FindObjectOfType <CameraMaster>(); bCam = FindObjectOfType <BodyCam>(); ted = FindObjectOfType <Teddy>(); rightEye = FindObjectOfType <TeddyRightEye>(); fearMeter = FindObjectOfType <Fear>(); tedDoorInside = tedDoorTrigInside.GetComponent <AutoDoor>(); tedDoorOutside = tedDoorTrigOutside.GetComponent <AutoDoor>(); anim = tedDoorToAnimate.GetComponent <Animator>(); animDup = tedDoorToAnimateDup.GetComponent <Animator>(); doorCollider = tedDoorToAnimate.GetComponent <Collider>(); statusWindow = FindObjectOfType <StatusPopup>(); doorOpen = false; tedInsideOrOut = false; wholeDoorTransportFromLocation = wholeDoorSetup.position; tedTransportFromLocation = ted.transform.position; rightEyeTransportFromLocation = rightEye.transform.position; }
void Build() { if (points.Count < 3) { return; } points = Utils2D.Constrain(points, threshold); if (points.Count < 3) { return; } teddy = new Teddy(points); var mesh = teddy.Build(MeshSmoothingMethod.HC, 2, 0.2f, 0.75f); var go = Instantiate(prefab); go.transform.parent = transform; var puppet = go.GetComponent <Puppet>(); puppet.SetMesh(mesh); puppets.Add(puppet); }
// Use this for initialization void Start() { view = FindObjectOfType <BodyCam>(); ted = FindObjectOfType <Teddy>(); anim = ted.GetComponent <Animator>(); rigid = ted.GetComponent <Rigidbody>(); tedHead = FindObjectOfType <TeddyHead>(); animHead = tedHead.GetComponent <Animator>(); wkDesk = FindObjectOfType <WorkDesk>(); commsImg = commsEnter.transform.parent.GetComponent <RawImage>(); leftEye = FindObjectOfType <TeddyLeftEye>(); rightEye = FindObjectOfType <TeddyRightEye>(); //leftEyeColl = leftEye.GetComponent<Collider>(); rightEyeColl = rightEye.GetComponent <Collider>(); //leftEyeRigid = leftEye.GetComponent<Rigidbody>(); rightEyeRigid = rightEye.GetComponent <Rigidbody>(); //headd = GameObject.Find("tedhead"); reticleImg = GameObject.Find("Reticle").GetComponent <RawImage>(); leftEyepatch = leftEye.transform.Find("lefteyepatch"); rightEyepatch = rightEye.transform.Find("righteyepatch"); gamePaused = false; mainOverlay.enabled = false; // mainOverlay is used for special screens, like loading, static, and jamming; off at start topRightInsert.enabled = false; // Picture within picture is off at start //leftEyeColl.enabled = false; rightEyeColl.enabled = false; //leftEyeRigid.isKinematic = true; rightEyeRigid.isKinematic = true; view.bodyCamActive = true; leftEyeLodged = true; // Eyes lodged at start rightEyeLodged = true; // leftEyeTransitioning = false; // Eyes not in process of lodging/dislodging at start rightEyeTransitioning = false; // jammed = false; // No jamming at start jamView = false; // clearView = true; // currentHallucinationFrameIndex = 0; hallucinationFrameTimeIndex = 0; reticleEnabled = true; hallucinating = false; atTedsRoom = false; commsEnabled = false; commsEnter.enabled = false; commsEnter.DeactivateInputField(); commsEnter.GetComponent <Image>().enabled = false; englishOrSolar = true; leftEyeAvailable = false; reticlePressTime = 0; reticlePressed = false; if (headbob) { headdRT = headdActualRT; headd = headActual; } else { headdRT = headdRefRT; headd = headNoBob; } //camTarget = null; //smoothdamp attempt initialPosBody = view.transform.localPosition; // Set initial positions for body and eyes initialPosLeft = leftEye.transform.localPosition; // initialPosRight = rightEye.transform.localPosition; // initialRotBody = view.transform.localRotation; // Set initial rotations for body and eyes returnRotLeft = leftEye.transform.localRotation; // returnRotRight = rightEye.transform.localRotation; SwitchCam(view.gameObject, headd, initialPosBody, initialRotBody); initialRotBody = view.transform.localRotation; eyeDislodgeTimer = 0.2f; eyeDislodgeTimerRef = 0; }
private void Start() { teddy = FindObjectOfType <Teddy>(); }
//-------------------------------------------------------------------------------------- // RocketExplode: This function is called when the Rocket should explode. // Calls CalculateDamage after it finds target in the sphere. //-------------------------------------------------------------------------------------- private void RocketExplode() { //m_asAudioSource.PlayOneShot(m_acExplosionSound); // Rocket Explodes, damaging anything within the radius // Collect all possible colliders Collider[] aSoldierColliders = Physics.OverlapSphere(transform.position, m_fSoldierExplosionRadius, m_lmUnitMask); Collider[] aTeddyColliders = Physics.OverlapSphere(transform.position, m_fTeddyExplosionRadius, m_lmTeddyMask); for (int i = 0; i < aSoldierColliders.Length; i++) { Rigidbody rbTarget = aSoldierColliders[i].GetComponent <Rigidbody>(); //if it does not have a rigidbody if (!rbTarget) { continue; } // if an object in collision zone is a Soldier if (aSoldierColliders[i].gameObject.tag == "Soldier") { // TODO: Explosion particle effect here if (!Physics.Linecast(transform.position, rbTarget.position, m_lmEnvironmentMask)) { SoldierActor gtarget = rbTarget.GetComponent <SoldierActor>(); // Soldier will take damage based on position (See CalculateDamge function below) gtarget.TakeDamage(CalculateDamage(aSoldierColliders[i].transform.position, m_fSoldierExplosionRadius)); // add explosive force for knockback // NOTE: May be replaced with a non-rigidbody knockback if (CalculateDamage(aSoldierColliders[i].transform.position, m_fSoldierExplosionRadius) > 1) { rbTarget.AddExplosionForce(m_ExplosionForce, transform.position, m_fSoldierExplosionRadius, 0.0f, ForceMode.Impulse); } } } } for (int i = 0; i < aTeddyColliders.Length; i++) { Rigidbody rbTarget = aTeddyColliders[i].GetComponent <Rigidbody>(); //if it does not have a rigidbody if (!rbTarget) { continue; } // if an object in collision zone is a Teddy if (aTeddyColliders[i].gameObject.tag == "Teddy") { // TODO: Explosion particle effect here if (!Physics.Linecast(transform.position, rbTarget.position, m_lmEnvironmentMask)) { Teddy gtarget = rbTarget.GetComponent <Teddy>(); // Teddy will take damage based on position (See CalculateDamge function below) gtarget.TakeDamage(CalculateDamage(aTeddyColliders[i].transform.position, m_fTeddyExplosionRadius)); } } } }