// Start is called before the first frame update void Start() { rigidbody = GetComponent <Rigidbody>(); sword = GetComponentInChildren <Sword>(); groundDetection = transform.Find("Feet").GetComponent <GroundDetection>(); //cameraController = GetComponentInChildren<AgentCameraController>(); }
void Start() { moveComponent = GetComponent <IMoveComponent>(); jumpComponent = GetComponent <IJumpComponent>(); shootComponent = GetComponent <IShootComponent>(); groundDetection = GetComponent <GroundDetection>(); }
void Awake() { _characterMotor = GetComponent <CharacterMotor>(); _groundDetection = GetComponent <GroundDetection>(); model = transform.GetChild(0); groundParticleSystem = GetComponentInChildren <ParticleSystem>(); }
private void Awake() { UpdateParameters(); _physicsHandler = GetComponent <PhysicsHandler>(); Debug.Assert(_physicsHandler, "You must add a PhysicsHandler !"); groundDetector = GetComponentInChildren <GroundDetection>(); Debug.Assert(groundDetector, "You must add a GroundDetector !"); }
private void Start() { groundRef = playerTransform.GetComponent <GroundDetection>(); anim = playerTransform.GetComponentInChildren <Animator>(); dashBar = GameObject.FindGameObjectWithTag("DashUI").GetComponent <Image>(); currentDashMeter = dashMeterMax; }
// Use this for initialization void Start() { ObjectTransform = GetComponent <Transform>(); DirectionFacing = GetComponent <Direction>(); Physics = GetComponent <Rigidbody2D>(); Collision = GetComponent <BoxCollider2D>(); GroundDetection = GetComponent <GroundDetection>(); }
private void Start() { playerT = GameObject.FindGameObjectWithTag("Player").GetComponent <Transform>(); playerAnim = GameObject.FindGameObjectWithTag("Player").GetComponentInChildren <Animator>(); playerRB = GameObject.FindGameObjectWithTag("Player").GetComponent <Rigidbody2D>(); groundDetectionRef = GameObject.FindGameObjectWithTag("Player").GetComponent <GroundDetection>(); defaultRunspeed = runSpeed; }
void Start() { rigidbody2D = GetComponent <Rigidbody2D>(); groundDetection = GetComponent <GroundDetection>(); // подписки на события GroundDetection groundDetection.GroundedEvent += GroundedEvent; groundDetection.AirborneEvent += GroundDetection_AirborneEvent; }
void Start() { ac = Resources.Load("coin") as AudioClip; child = transform.GetChild(0); gd = child.GetComponent<GroundDetection>(); jumpCount = 2; music = Resources.Load("bigfoot") as AudioClip; transform.audio.PlayOneShot(music); }
protected virtual void Awake() { if (GetComponent <Rigidbody>() != null) { _rb = GetComponent <Rigidbody>(); } if (GetComponent <GroundDetection>() != null) { _groundDetection = GetComponent <GroundDetection>(); } }
void Start() { wdetecdtor = GameObject.Find("WallDetector"); wdetector2 = GameObject.Find("WallDetector2"); GroundDetector = GameObject.Find("GroundDetector"); LiftUpDetector = GameObject.Find("LiftUpDetector"); LandingDetector = GameObject.Find("LandingDetector"); fScript = wdetecdtor.GetComponent <WallDetection>(); fScript2 = wdetector2.GetComponent <WallDetection2>(); gScript = GroundDetector.GetComponent <GroundDetection>(); lScript = LiftUpDetector.GetComponent <LiftUpDetection>(); landingScript = LandingDetector.GetComponent <LandingDetection>(); dude = gameObject.GetComponent <Rigidbody2D>(); anim = gameObject.GetComponent <Animator>(); }
void Start() { groundDetection = GetComponent <GroundDetection>(); rigidbody2d = GetComponent <Rigidbody2D>(); spriteRenderer = GetComponent <SpriteRenderer>(); touchDamage = GetComponent <TouchDamage>(); //BoundaryDefinition leftBorder = firstBorder; rightBorder = secondBorder; if (firstBorder.transform.position.x > secondBorder.transform.position.x) { leftBorder = secondBorder; rightBorder = firstBorder; } }
// Use this for initialization void Start() { GameObject.Find("hookLook").GetComponent <SpriteRenderer>().enabled = false; rb2d = gameObject.GetComponentInChildren <Rigidbody2D>(); location = GameObject.Find("grappHook"); player = GameObject.Find("Player"); groundDet = GameObject.Find("GroundDetector"); gScript = groundDet.GetComponent <GroundDetection>(); hook = player.GetComponent <DistanceJoint2D>(); hinge = player.GetComponent <HingeJoint2D>(); spring = player.GetComponent <SpringJoint2D>(); line = GetComponent <LineRenderer>(); line.enabled = false; mScript = player.GetComponent <Movement>(); playerPhysics = player.GetComponent <Rigidbody2D>(); }
public static void DrawGroundDetectionGizmos(GroundDetection groundDetection, GizmoType gizmosType) { if (!Application.isPlaying) { return; } var groundPoint = groundDetection.groundPoint; var groundNormal = groundDetection.groundNormal; // Ground Normal Gizmos.color = Color.yellow; Gizmos.DrawRay(groundPoint, groundNormal); // Ground point var r = Vector3.ProjectOnPlane(Vector3.right, groundNormal); var f = Vector3.ProjectOnPlane(Vector3.forward, groundNormal); Gizmos.color = Color.blue; Gizmos.DrawLine(groundPoint - r * 0.25f, groundPoint + r * 0.25f); Gizmos.DrawLine(groundPoint - f * 0.25f, groundPoint + f * 0.25f); }
public void InitPlayerComponent(NFGUID xID, GameObject self, bool bMainRole) { if (null == self) { return; } if (!self.GetComponent <Rigidbody>()) { self.AddComponent <Rigidbody>(); } if (!self.GetComponent <NFHeroSyncBuffer>()) { self.AddComponent <NFHeroSyncBuffer>(); } if (!self.GetComponent <NFHeroSync>()) { self.AddComponent <NFHeroSync>(); } NFHeroInput xInput = self.GetComponent <NFHeroInput>(); if (!xInput) { xInput = self.AddComponent <NFHeroInput>(); } if (bMainRole) { xInput.enabled = true; xInput.SetInputEnable(true); } else { xInput.enabled = false; xInput.SetInputEnable(false); } if (!self.GetComponent <GroundDetection>()) { GroundDetection groundDetection = self.AddComponent <GroundDetection>(); groundDetection.enabled = true; groundDetection.groundMask = -1; } if (!self.GetComponent <CharacterMovement>()) { CharacterMovement characterMovement = self.AddComponent <CharacterMovement>(); characterMovement.enabled = true; } if (!self.GetComponent <NFHeroMotor>()) { NFHeroMotor xHeroMotor = self.AddComponent <NFHeroMotor>(); xHeroMotor.enabled = true; } if (!self.GetComponent <NFAnimatStateController>()) { NFAnimatStateController xHeroAnima = self.AddComponent <NFAnimatStateController>(); xHeroAnima.enabled = true; } if (!self.GetComponent <NFAnimaStateMachine>()) { NFAnimaStateMachine xHeroAnima = self.AddComponent <NFAnimaStateMachine>(); xHeroAnima.enabled = true; } if (bMainRole) { CapsuleCollider xHeroCapsuleCollider = self.GetComponent <CapsuleCollider>(); xHeroCapsuleCollider.isTrigger = false; } else { CapsuleCollider xHeroCapsuleCollider = self.GetComponent <CapsuleCollider>(); Rigidbody rigidbody = self.GetComponent <Rigidbody>(); string configID = mKernelModule.QueryPropertyString(xID, NFrame.IObject.ConfigID); NFMsg.ENPCType npcType = (NFMsg.ENPCType)mElementModule.QueryPropertyInt(configID, NFrame.NPC.NPCType); //NFMsg.esub npcSubType = (NFMsg.ENPCType)mElementModule.QueryPropertyInt(configID, NFrame.NPC.NPCSubType); if (npcType == NFMsg.ENPCType.TurretNpc) { //is trigger must false if it is a building // and the kinematic must true xHeroCapsuleCollider.isTrigger = false; //rigidbody.isKinematic = true; //rigidbody.useGravity = true; rigidbody.mass = 10000; } else { xHeroCapsuleCollider.isTrigger = true; } /* * if (mKernelModule.QueryPropertyObject(xID, NFrame.NPC.MasterID) == mLoginModule.mRoleID) * { * //your building or your clan member building * if (!self.GetComponent<FogCharacter>()) * { * FogCharacter fogCharacter = self.AddComponent<FogCharacter>(); * fogCharacter.enabled = true; * fogCharacter.radius = 8; * } * } * else * { * if (!self.GetComponent<FogAgent>()) * { * FogAgent fogAgent = self.AddComponent<FogAgent>(); * fogAgent.enabled = true; * } * } */ } }
// Use this for initialization void Start() { objectRB = GetComponent <Rigidbody2D>(); playerGroundRef = GetComponent <GroundDetection>(); }
// Start is called before the first frame update void Start() { groundDetection = new GroundDetection(_groundDetector, layer, 1.0f); }
void Awake() { _groundDetection = GetComponent <GroundDetection>(); _obstacleAvoidance = GetComponent <ObstacleAvoidance>(); }
void Start() { collider = GetComponent <BoxCollider>(); instance = this; distToGround = collider.bounds.extents.y; }
// Start is called before the first frame update void Start() { rigidbody = GetComponent <Rigidbody>(); sword = GetComponentInChildren <Sword>(); groundDetection = transform.Find("Feet").GetComponent <GroundDetection>(); }
public void InitPlayerComponent(NFGUID xID, GameObject self, bool bMainRole) { if (null == self) { return; } if (!self.GetComponent <Rigidbody>()) { self.AddComponent <Rigidbody>(); } if (!self.GetComponent <NFHeroSyncBuffer>()) { self.AddComponent <NFHeroSyncBuffer>(); } if (!self.GetComponent <NFHeroSync>()) { self.AddComponent <NFHeroSync>(); } NFHeroInput xInput = self.GetComponent <NFHeroInput>(); if (!xInput) { xInput = self.AddComponent <NFHeroInput>(); } if (bMainRole) { xInput.enabled = true; xInput.SetInputEnable(true); } else { xInput.enabled = false; xInput.SetInputEnable(false); } if (!self.GetComponent <GroundDetection>()) { GroundDetection groundDetection = self.AddComponent <GroundDetection>(); groundDetection.enabled = true; groundDetection.groundMask = -1; } if (!self.GetComponent <CharacterMovement>()) { CharacterMovement characterMovement = self.AddComponent <CharacterMovement>(); characterMovement.enabled = true; } if (!self.GetComponent <NFHeroMotor>()) { NFHeroMotor xHeroMotor = self.AddComponent <NFHeroMotor>(); xHeroMotor.enabled = true; } if (!self.GetComponent <NFAnimatStateController>()) { NFAnimatStateController xHeroAnima = self.AddComponent <NFAnimatStateController>(); xHeroAnima.enabled = true; } if (!self.GetComponent <NFAnimaStateMachine>()) { NFAnimaStateMachine xHeroAnima = self.AddComponent <NFAnimaStateMachine>(); xHeroAnima.enabled = true; } if (bMainRole) { if (Camera.main) { NFHeroCameraFollow xHeroCameraFollow = Camera.main.GetComponent <NFHeroCameraFollow>(); if (!xHeroCameraFollow) { xHeroCameraFollow = Camera.main.GetComponentInParent <NFHeroCameraFollow>(); } xHeroCameraFollow.target = self.transform; } CapsuleCollider xHeroCapsuleCollider = self.GetComponent <CapsuleCollider>(); xHeroCapsuleCollider.isTrigger = false; } else { CapsuleCollider xHeroCapsuleCollider = self.GetComponent <CapsuleCollider>(); Rigidbody rigidbody = self.GetComponent <Rigidbody>(); string configID = mKernelModule.QueryPropertyString(xID, NFrame.IObject.ConfigID); NFMsg.ENPCType npcType = (NFMsg.ENPCType)mElementModule.QueryPropertyInt(configID, NFrame.NPC.NPCType); //NFMsg.esub npcSubType = (NFMsg.ENPCType)mElementModule.QueryPropertyInt(configID, NFrame.NPC.NPCSubType); if (npcType == NFMsg.ENPCType.TurretNpc) { //is trigger must false if it is a building // and the kinematic must true xHeroCapsuleCollider.isTrigger = false; //rigidbody.isKinematic = true; //rigidbody.useGravity = true; rigidbody.mass = 10000; } else { xHeroCapsuleCollider.isTrigger = true; } } }
private void Start() { groundDetection = GetComponent <GroundDetection>(); }