// this needs some more thought... private void PlayDead() { if (stimulus.GetCurrentOrigin() == Stimulus.origin.Incapacitated) { stimulus.SetCurrentOrigin(Stimulus.origin.Guard); } else { stimulus.SetCurrentOrigin(Stimulus.origin.Incapacitated); } }
private void Copy() { Mesh closestMesh = baseMesh; Stimulus.origin meshStimulusOrigin = Stimulus.origin.Patient; float minDist = Mathf.Infinity; // in case player is an object and activates power while sneaking. movingObject = false; foreach (ICopyable copyable in Copyables) { Vector3 positionOfCopyable = copyable.GetPosition(); float testDist = Vector3.Distance(transform.position, positionOfCopyable); if (minDist > testDist) { Ray testLineOfSight = new Ray(); testLineOfSight.origin = transform.position; testLineOfSight.direction = positionOfCopyable - transform.position; RaycastHit hit; // test if the copyable can be seen by the player if (Physics.Raycast(testLineOfSight, out hit)) { ICopyable testCopyable = hit.transform.gameObject.GetComponent <ICopyable>(); if (testCopyable != null) { minDist = testDist; closestMesh = testCopyable.GetMesh(); meshStimulusOrigin = testCopyable.GetOriginOfStimulus(); // copiedPower = testCopyable.GetPower(); } } } } if (minDist > 5f) { closestMesh = baseMesh; meshStimulusOrigin = Stimulus.origin.Patient; } GetComponent <MeshFilter>().mesh = closestMesh; stimulus.SetCurrentOrigin(meshStimulusOrigin); }