//Smash attack if possilbe, throw otherwise public override float Attack1() { float attackTime = 0f; Tentacle tentacle = ClosestTentacle(); if (tentacle == null) { return(0f); } if (tentacle.InRange) { tentacle.EngageSmashAttack(true); attackTime = smashAttackTime + Tentacle.smashWaitTime; } else { if (Utils.Instance.Rng.Next() % 4 == 0) { attackTime = Attack6(); } else { tentacle.EngageThrowAttack(Boat.transform.position); attackTime = throwAttackTime + Tentacle.throwWaitTime; } } return(attackTime);; }
// Start is called before the first frame update void Awake() { tentacles = new Tentacle[numTentacles]; tentacles[0] = tentacleArm.GetComponentInChildren <Tentacle>(); float angleStep = 360f / numTentacles; for (int i = 1; i < numTentacles; i++) { GameObject newTentacleArm = GameObject.Instantiate(tentacleArm.gameObject); GameObject newEndpointArm = GameObject.Instantiate(endpointArm.gameObject); newTentacleArm.transform.parent = tentaclesHolder; newEndpointArm.transform.parent = endPointsHolder; Quaternion rot = tentacleArm.rotation * Quaternion.Euler(new Vector3(angleStep * i, 0, 0)); newTentacleArm.transform.rotation = rot; newEndpointArm.transform.rotation = rot; Tentacle t = newTentacleArm.GetComponentInChildren <Tentacle>(); t.endPoint = newEndpointArm.transform.GetChild(0); tentacles[i] = t; } originalEndpointsRotation = endPointsHolder.localRotation; originalRotation = transform.localRotation; originalScale = transform.localScale; if (startWithRandomRotation) { transform.localRotation = originalRotation * Quaternion.Euler(Random.Range(0, 360), 0, 0); } }
//public Vector2 targetPosition; public void Initialize(Tentacle parent, int index) { parentTentacle = parent; this.index = index; tOffset = (float)index / (float)parentTentacle.segments * Mathf.PI * 2.0f; //myRigidBody = gameObject.AddComponent<Rigidbody2D>(); //myRigidBody.bodyType = RigidbodyType2D.Kinematic; //myRigidBody.gravityScale = 0; float w = parentTentacle.GetTentSegmentWidth(index); GameObject stretchSegment = Object.Instantiate(parentTentacle.GetTentSegmentPrefab(index), transform); stretchSegment.name = string.Format("Segment {0}", index); stretchSegment.transform.localScale = new Vector3(1.0f, w, 1.0f); stretchSegment.transform.localPosition = Vector2.zero; stretchTo = stretchSegment.GetComponent <StretchTo>(); GameObject roundSegment = Object.Instantiate(parent.pack.tentacleSpriteRounderPrefab, transform); roundSegment.name = string.Format("Rounder {0}", index); roundSegment.transform.localScale = new Vector3(w, w, 1.0f); roundSegment.transform.localPosition = new Vector3(0, 0, 1); lastPoint = parentTentacle.GetTentSegmentLastPoint(index); nextPoint = parentTentacle.endPoint; parentTentacle.UpdateTentSegmentNextPointMaybe(this); }
private Tentacle ClosestTentacle() { Tentacle closestTentacle = null; Vector3 boatPos = GlobalScript.Instance.Boat.transform.position; float distance = 0f; foreach (Tentacle t in LiveTentacles) { if (closestTentacle == null) { closestTentacle = t; distance = t.Distance; } else { float tDistance = t.Distance; if (tDistance < distance) { distance = tDistance; closestTentacle = t; } } } return(closestTentacle); }
/// <summary> /// メニューの表示・非表示を切り替える /// </summary> public void ToggleMenu() { if (isFreeze) { return; } //音の再生 AudioManager.Play(SEType.Button, 1); Debug.Log("(/・ω・)/"); bool isOpen = !animator.GetBool("Open"); animator.SetBool("Open", isOpen); if (isOpen) { //マスクのIDを設定 int bgmID = Tentacle.GetNextMaskID(); bgmTentacleInstance.sharedMaterial = ResourceLoader.GetMaterial(R_MaterialType.MaskableSprite); bgmTentacleInstance.sharedMaterial.SetInt("_ID", bgmID); bgmMaskRenderer.material = ResourceLoader.GetMaterial(R_MaterialType.MaskingSprite); bgmMaskRenderer.material.SetInt("_ID", bgmID); int seID = Tentacle.GetNextMaskID(); seTentacleInstance.sharedMaterial = ResourceLoader.GetMaterial(R_MaterialType.MaskableSprite); seTentacleInstance.sharedMaterial.SetInt("_ID", seID); seMaskRenderer.material = ResourceLoader.GetMaterial(R_MaterialType.MaskingSprite); seMaskRenderer.material.SetInt("_ID", seID); Debug.Log("set"); } }
public static void CopyTentSegments(Tentacle source, Tentacle dest) { dest.ClearSegments(); dest.segments = source.segments; dest.startWidth = source.startWidth; dest.endWidth = source.endWidth; dest.length = source.length; dest.GenerateSegments(); for (int i = 0; i < dest.tentJoints.Count; i++) { TentJoint destJoint = dest.tentJoints[i]; TentJoint sourceJoint = source.tentJoints[i]; destJoint.transform.position = dest.transform.position + source.transform.InverseTransformPoint(sourceJoint.transform.position); destJoint.gameObject.transform.position = dest.transform.position + source.transform.InverseTransformPoint(sourceJoint.gameObject.transform.position); //destJoint.gameObject.GetComponent<StretchTo>().RecalculateStart(); //destJoint.gameObject.GetComponent<StretchTo>().RunStretch(); //destJoint.lastPosition = sourceJoint.lastPosition; //destJoint.velocity = sourceJoint.velocity; ////public List<Vector2> targetPositions; //destJoint.tOffset = sourceJoint.tOffset; } //dest.t = source.t; }
// Use this for initialization void Start() { myBody = GetComponentInParent <Rigidbody2D>(); leftIdle = transform.Find("LeftIdle"); rightIdle = transform.Find("RightIdle"); for (int i = 0; i < tentaclesPerSide; i++) { Tentacle tentacle = TentacleMaker.Basic(pack, 9); tentacle.transform.parent = transform; tentacle.transform.localPosition = Vector2.zero; tentacle.AttachBase(myBody, myBody.transform.position); tentacle.AttachEnd(myBody, RightIdlePosition()); rightSideTentacles.Add(tentacle); } for (int i = 0; i < tentaclesPerSide; i++) { Tentacle tentacle = TentacleMaker.Basic(pack, 9); tentacle.transform.parent = transform; tentacle.transform.localPosition = Vector2.zero; tentacle.AttachBase(myBody, myBody.transform.position); tentacle.AttachEnd(myBody, LeftIdlePosition()); leftSideTentacles.Add(tentacle); } }
public LightWorm(AbstractCreature abstractCreature, World world) : base(abstractCreature, world) { bodyChunks = new BodyChunk[2]; bodyChunks[0] = new BodyChunk(this, 0, new Vector2(0f, 0f), 8f, 0.05f); bodyChunks[1] = new BodyChunk(this, 0, new Vector2(0f, 0f), 8f, 0.05f); bodyChunks[0].rotationChunk = bodyChunks[1]; bodyChunks[1].collideWithTerrain = false; bodyChunkConnections = new PhysicalObject.BodyChunkConnection[0]; tentacle = new Tentacle(this, bodyChunks[1], 400f * bodySize); tentacle.tProps = new Tentacle.TentacleProps(false, false, true, 0.5f, 0f, 1.4f, 0f, 0f, 1.2f, 10f, 0.25f, 5f, 15, 60, 12, 0); tentacle.tChunks = new Tentacle.TentacleChunk[(int)(15f * Mathf.Lerp(bodySize, 1f, 0.5f))]; for (int i = 0; i < tentacle.tChunks.Length; i++) { tentacle.tChunks[i] = new Tentacle.TentacleChunk(tentacle, i, (float)(i + 1) / (float)tentacle.tChunks.Length, 2f * Mathf.Lerp(bodySize, 1f, 0.5f)); } tentacle.stretchAndSqueeze = 0.1f; GoThroughFloors = true; airFriction = 0.99f; gravity = 0.9f; bounce = 0.1f; surfaceFriction = 0.47f; collisionLayer = 1; waterFriction = 0.92f; buoyancy = 0.95f; extended = 1f; retractSpeed = 1f; lastExtended = true; }
public void UpdateTent(Tentacle tentacle, Vector3 idle) { Vector2 n = CommonUtils.NormalVector(transform.position, tentacle.endPoint.position); //float theta = CommonUtils.ThetaBetween(n, climbDirection); float nAsAngle = CommonUtils.VectorToAngle(n); float dAsAngle = CommonUtils.VectorToAngle(climbDirection); float angleDifference = dAsAngle - nAsAngle; // TODO: account for values that are pointing left/west, that either give -pi or pi float d = CommonUtils.Distance(transform.position, tentacle.endPoint.position); if (tentacle.Grabbing) { if (d > reach * 0.5f && Mathf.Abs(angleDifference) > Mathf.PI * 2f / 4f) { tentacle.StopGrabbing(); tentacle.AttachEnd(myBody, idle); } else { if (d > 1.0f) { if (Mathf.Abs(angleDifference) < Mathf.PI * 0.5f) { tentacle.joint.distance -= stretchSpeed + speedBoostActual; } else { tentacle.joint.distance += stretchSpeed + speedBoostActual; } } } } }
// 2.8442 // 5.688429 void ClampTentacles(Tentacle tent) { var allowedPos = transform.position - tent.anchorPos.position; allowedPos = Vector2.ClampMagnitude(allowedPos, tentacleRange); // Only adjust the x value of the transform when on ceiling or ground if (groundingTB != Grounding.None) { transform.position = new Vector2(tent.anchorPos.position.x + allowedPos.x, transform.position.y); } // Only adjust the y value of the transform when on walls if (groundingLR != Grounding.None) { transform.position = new Vector2(transform.position.x, tent.anchorPos.position.y + allowedPos.y); } if (groundingLR == Grounding.None && groundingTB == Grounding.None) { transform.position = new Vector2(tent.anchorPos.position.x + allowedPos.x, tent.anchorPos.position.y + allowedPos.y); } if (Vector2.Distance(tent.anchorPos.position, transform.position) > tentacleRange) { rb.velocity = new Vector2(0f, 0f); } }
public void SeparateThisSegment() { // Destroy the tentacle. Body will grow new segment soon controller.segments.Remove(this); this.destroyed = true; Tentacle next_segment = forward_connected_tentacle; while (next_segment != null) { next_segment.destroyed = true; controller.segments.Remove(next_segment); next_segment = next_segment.forward_connected_tentacle; } // Remove connection behind us if (backward_connected_tentacle != null) { if (!backward_connected_tentacle.body_connected_tentacle) { backward_connected_tentacle.GetComponent<HingeJoint2D>().enabled = false; } else { backward_connected_tentacle.GetComponents<HingeJoint2D>()[1].enabled = false; } backward_connected_tentacle.forward_connected_tentacle = null; } this.backward_connected_tentacle = null; controller.ReevaluateTentacleTip(); }
//only used by tentacle public void TentacleEaten(Tentacle t) { bool eaten = false; for (int i = 0; i < mTentacles.Length; i++) { if (mTentacles[i] == t) { t.transform.parent = mTentacleParents[i]; t.transform.localPosition = Vector3.zero; t.transform.localRotation = Quaternion.identity; t.transform.localScale = Vector3.one; mTentacleParents[i].gameObject.SetActiveRecursively(false); mNumActiveTentacles--; eaten = true; break; } } if (eaten) { //reset tentacle targets, make them untargettable, get hurt a bit if (mNumActiveTentacles == 0) { //eyes are vulnerable, sit helpless in tears SetStatus(Status.EyesExposed); } else //ouch { SetStatus(Status.TentacleEaten); } } }
//Send tentacle to boat position and slam public override float Attack6() { tentacleInMovement = ClosestTentacle(); if (tentacleInMovement == null) { return(0f); } //vector between tentacle and boat Vector3 newPosition = (Boat.transform.position - tentacleInMovement.transform.position); //level the vector on XZ plane newPosition.y = 0; //find travel distance for a good hit float distance = newPosition.magnitude; distance = distance - tentacleInMovement.Range / 2; //apply distance to position of boat newPosition = tentacleInMovement.transform.position + newPosition.normalized * distance; Quaternion lookAt = Quaternion.LookRotation(Boat.transform.position - newPosition); SendTentacleToPosition(tentacleInMovement, newPosition, lookAt); tentacleMvmntTimer = 0f; inTentacleMvmnt = true; return(tentacleMvmntDelay + smashAttackTime + Tentacle.smashWaitTime); }
bool SpawnTentacle(int id, Vector2 spawnPos, Vector2 angle) { //邪魔していたらキャンセルアニメーションを再生 Piece anglePiece = StageGenerator.GetPiece(angle + spawnPos); if (anglePiece) { if (!isFailAnimPlay[id]) { StartCoroutine(FailCreateAnimation(id, anglePiece.position)); } return(false); } //触手の生成開始 if (currenTentacle[id]) { currenTentacle[id].Return(); } currenTentacle[id] = Tentacle.CreateTentacle(spawnPos); currenTentacle[id].angle = angle; currenTentacle[id].transform.position = spawnPos; //デバッグ用でSEを鳴らす //AudioManager.Play(SEType.Tap, 1); return(true); }
public void Grapple(Tentacle tentacle, Rigidbody2D grappledBody, Vector3 grappledPoint, bool playSound = true) { //StartCoroutine(_waitForTentEndToGrab(tentacle, grappledBody, grappledPoint, playSound)); tentacle.SetGrabbing(grappledBody.gameObject, grappledPoint, playSound); tentacle.joint.distance = CommonUtils.Distance(tentacle.transform.position, grappledPoint); tentacle.AttachEnd(grappledBody, grappledPoint); }
public bool TryGrapple(Tentacle tentacle, Vector2 direction) { if (!tentacle.Grabbing) { RaycastHit2D[] hits = Physics2D.RaycastAll(transform.position, direction, reach, m_WhatIsGrabbable); foreach (var hit in hits) { if (hit.collider != null) { Rigidbody2D rigidBody = hit.collider.gameObject.GetComponentInChildren <Rigidbody2D>(); if (rigidBody != null && (rigidBody.bodyType == RigidbodyType2D.Static || rigidBody.bodyType == RigidbodyType2D.Kinematic)) { float distance = CommonUtils.Distance(transform.position, hit.point); if (distance > minReach) { Grapple(tentacle, rigidBody, hit.point); return(true); } } } } } return(false); }
public ITentacleState ChangeState(Tentacle tentacle, GameObject gameObject) { if (tentacle.bodyPartCount_ == 0) { return(new DeadState(tentacle)); } return(this); }
//构造函数 public TentacleChunk(Tentacle tentacle, int tentacleIndex, float tPos, float rad) { this.tentacle = tentacle; this.tPos = tPos; this.rad = rad; this.tentacleIndex = tentacleIndex; collideWithTerrain = true; }
// Use this for initialization void Start() { tentacle = gameObject.GetComponent <Tentacle>(); lineRenderer = GetComponent <LineRenderer> (); claw = GameObject.Find("CraneClaw"); cam_first_pos = Camera.main.GetComponent <CameraScript> ().firstPosition; // Renderer MyRenderer = gameObject.GetComponent<Renderer>(); // MyRenderer.sortingLayerName = "Foreground"; }
public static void CopyTentSubSegments(Tentacle source, Tentacle dest, int start, int end) { //if (start < 0 || end > source.segments) { // throw new Exception("Can't make a sub segment with these bounds."); //} dest.ClearSegments(); dest.segments = end - start + 1; dest.pack = source.pack; dest.alternateSprites = source.alternateSprites; float width_dif = source.endWidth - source.startWidth; dest.startWidth = source.startWidth + width_dif * ((float)start / (float)source.segments); dest.endWidth = source.startWidth + width_dif * ((float)end / (float)source.segments); dest.length = source.length * ((float)dest.segments / (float)source.segments); dest.GenerateSegments(); if (start > 0) { dest.transform.position = source.tentJoints[start - 1].transform.position; } else { dest.transform.position = source.transform.position; } if (end < source.segments - 1) { dest.endPoint.position = source.tentJoints[end].transform.position; } else { dest.endPoint.position = source.endPoint.position; } dest.baseSegment.transform.localPosition = Vector2.zero; for (int i = 0; i < dest.tentJoints.Count; i++) { TentJoint destJoint = dest.tentJoints[i]; TentJoint sourceJoint = source.tentJoints[i + start]; destJoint.transform.position = sourceJoint.transform.position; //destJoint.transform.position = dest.transform.position + source.transform.InverseTransformPoint(sourceJoint.transform.position); //destJoint.gameObject.transform.position = dest.transform.position + source.transform.InverseTransformPoint(sourceJoint.gameObject.transform.position); //destJoint.lastPosition = sourceJoint.lastPosition; //destJoint.velocity = sourceJoint.velocity; ////public List<Vector2> targetPositions; //destJoint.tOffset = sourceJoint.tOffset; } //dest.AdjustJoints(); //dest.t = source.t; }
public void DoStateAction(Tentacle tentacle) { headDistance_ = Vector3.Distance(tentacle_.Head_.transform.position, target_.transform.position); if (headDistance_ <= nextPartDistance_) { nextPartDistance_ = headDistance_ - bodyPartRadius_; tentacle_.CreateBodyPart(); } HandleExtensionMovement(); }
void Awake() { if(detectionCollider == null) detectionCollider = GetComponentInChildren<BoxCollider>() as BoxCollider; if(blockingTentacle == null) blockingTentacle = GetComponentInChildren<Tentacle>() as Tentacle; blockingTentacle.transform.position = blockingTentacle.transform.position - Vector3.up*80f; }
void LeftClick() { Collider[] cols = Physics.OverlapSphere(transform.position, 1.5f); float min = 1000f; Vector3 closestPoint = Vector3.zero; GameObject o = null; foreach (Collider col in cols) { if (col.gameObject.name != "Trigger" && col.gameObject.tag != "Player") { Vector3 p = col.bounds.ClosestPoint(transform.position); float d = (p - transform.position).sqrMagnitude; if (d < min) { min = d; closestPoint = p; o = col.gameObject; } } } if (closestPoint == Vector3.zero) { return; } Vector3 dir = fwd.position - cam.position; GameObject obj = Instantiate(basicTentacle, Vector3.zero, Quaternion.identity) as GameObject; Tentacle t = obj.GetComponent <Tentacle> (); if (o.GetComponent <MeshPart> ()) { MeshPart omp = o.GetComponent <MeshPart> (); t.origin = omp.startPosition; t.customOrigin = true; t.startRadius = omp.startRadius * 1.3f; t.direction = dir.normalized; } else { t.origin = transform.position; t.direction = dir.normalized; t.origin = closestPoint; } t.Go(); }
private void RegenTentacles() { //TODO: animation of sort for (int i = 0; i < mTentacles.Length; i++) { Tentacle t = mTentacles[i]; t.gameObject.layer = Main.layerItem; mTentacleParents[i].gameObject.SetActiveRecursively(true); } mNumActiveTentacles = mTentacles.Length; }
//Throw iceberg with closest tentacle public override float Attack2() { Tentacle tentacle = ClosestTentacle(); if (tentacle == null) { return(0f); } tentacle.EngageThrowAttack(Boat.transform.position); return(throwAttackTime + Tentacle.throwWaitTime); }
public AtTargetState(GameObject target, Tentacle tentacle) { tentacle_ = tentacle; target_ = target; bodyPartRadius_ = 0.2f; pulseTime_ = 0; pulseHoldTime_ = 0.03f; tentacleHead_ = tentacle.Head_.GetComponent <TentaclePart>(); atCell_ = tentacleHead_.targetGO_.GetComponent <Cell>() != null; targetCell_ = target.GetComponent <Cell>(); }
private void TentacleInput(Tentacle tentacle, Vector2 input) { var tentacleSpeed = InAir ? TentacleSettings.InAir.TentacleSpeed : TentacleSettings.UnderWater.TentacleSpeed; if (input.sqrMagnitude <= 0f) { input = Vector2.down; tentacleSpeed = InAir ? TentacleSettings.InAir.TentacleFallSpeed : TentacleSettings.UnderWater.TentacleSinkSpeed; } tentacle.MoveTarget(input * tentacleSpeed * Time.deltaTime); }
void TentacleAttack(Vector3 _position) { Tentacle t = GetFreeTentacle(); if (null != t) { t.gameObject.transform.position = _position; t.gameObject.SetActive(true); t.cooldown = TENTACLE_CD; SetEyeState(EyeState.Angry); } }
void Awake() { if (detectionCollider == null) { detectionCollider = GetComponentInChildren <BoxCollider>() as BoxCollider; } if (blockingTentacle == null) { blockingTentacle = GetComponentInChildren <Tentacle>() as Tentacle; } }
private void Awake() { tentacles = new Tentacle[instanceCount]; for (int i = 0; i < instanceCount; i++) { Tentacle tentacle = Instantiate(tentaclePrefab) as Tentacle; tentacle.transform.parent = transform; tentacle.gameObject.SetActive(false); tentacles[i] = tentacle; } }
private void ApplyTentacleConstraint(Tentacle tentacle) { var center = TargetBounds.bounds.center; var radius = TargetBounds.radius; var delta = tentacle.Target.position - center; if (delta.sqrMagnitude >= radius * radius) { tentacle.SetTarget(center + delta.normalized * radius); } }
private Tentacle CreatePart() { GameObject obj = Instantiate(part, part.transform.position, part.transform.rotation) as GameObject; Tentacle tentacle = obj.GetComponent <Tentacle>(); tentacle.connected = tantacles[tantacles.Count - 1].GetComponent <Rigidbody>(); obj.transform.parent = tantacles[tantacles.Count - 1].transform.parent; obj.name = "part" + tantacles.Count.ToString(); return(tentacle); }
void Start() { cur_regrowth = time_to_grow_new_segment; segments = new List<Tentacle>(this.transform.GetComponentsInChildren<Tentacle>()); foreach (Tentacle tentacle in segments) { if (tentacle.body_connected_tentacle) { body_end_tentacle = tentacle; break; } } //StartCoroutine(initialize()); CmdReevaluateTentacleTip(); }
public void ImmediateSettings() { cur_regrowth = time_to_grow_new_segment; segments = new List<Tentacle>(this.transform.GetComponentsInChildren<Tentacle>()); foreach (Tentacle tentacle in segments) { if (tentacle.body_connected_tentacle) { body_end_tentacle = tentacle; break; } } }
private int RightToLeft(Tentacle a, Tentacle b) { //position far right of Kraken Vector3 comparePos = body.transform.right*100000 + body.transform.position; float aDist = Vector3.Distance(a.transform.position,comparePos); float bDist = Vector3.Distance(b.transform.position,comparePos); int returnVal = 0; if(aDist < bDist) returnVal = -1; else if(bDist < aDist) returnVal = 1; return returnVal; }
private int DistanceToBoat(Tentacle a, Tentacle b) { int returnVal = 0; float aDist = a.Distance; float bDist = b.Distance; if(aDist < bDist) returnVal = -1; else if(bDist < aDist) returnVal = 1; return returnVal; }
public void SendTentacleToPosition(Tentacle tentacle, Vector3 position, Quaternion lookAtRotation) { tentacle.MovePosition(position,tentacleMvmntDelay); tentacle.MoveRotation(lookAtRotation,tentacleMvmntDelay); }
//Send tentacle to boat position and slam public override float Attack6() { tentacleInMovement = ClosestTentacle(); if(tentacleInMovement == null) return 0f; //vector between tentacle and boat Vector3 newPosition = (Boat.transform.position - tentacleInMovement.transform.position); //level the vector on XZ plane newPosition.y = 0; //find travel distance for a good hit float distance = newPosition.magnitude; distance = distance - tentacleInMovement.Range/2; //apply distance to position of boat newPosition = tentacleInMovement.transform.position + newPosition.normalized*distance; Quaternion lookAt = Quaternion.LookRotation(Boat.transform.position - newPosition); SendTentacleToPosition(tentacleInMovement,newPosition,lookAt); tentacleMvmntTimer = 0f; inTentacleMvmnt = true; return tentacleMvmntDelay + smashAttackTime + Tentacle.smashWaitTime; }
/// <summary> /// 获取两个细胞间的触手,如果不存在将创建 /// </summary> /// <param name="cell1"></param> /// <param name="cell2"></param> /// <returns></returns> private Tentacle getTentacle(Cell cellA, Cell cellB) { if (cellA.index > cellB.index) { Cell cell = cellA; cellA = cellB; cellB = cell; } string key = cellA.index + ":" + cellB.index; if (tentacleDic.ContainsKey(key)) { return tentacleDic[key]; } Tentacle tentacle = new Tentacle(); tentacle.setNodes(cellA, cellB); tentacleDic.Add(key, tentacle); return tentacle; }
//only used by tentacle public void TentacleEaten(Tentacle t) { bool eaten = false; for(int i = 0; i < mTentacles.Length; i++) { if(mTentacles[i] == t) { t.transform.parent = mTentacleParents[i]; t.transform.localPosition = Vector3.zero; t.transform.localRotation = Quaternion.identity; t.transform.localScale = Vector3.one; mTentacleParents[i].gameObject.SetActiveRecursively(false); mNumActiveTentacles--; eaten = true; break; } } if(eaten) { //reset tentacle targets, make them untargettable, get hurt a bit if(mNumActiveTentacles == 0) { //eyes are vulnerable, sit helpless in tears SetStatus(Status.EyesExposed); } else { //ouch SetStatus(Status.TentacleEaten); } } }