private void Start() { mage = GetComponent <Mage>(); //ch = GetComponent<Character>(); rayCont = GetComponent <RaycastController>(); cam = Camera.main.transform; }
// Called before Start private void Awake() { raycastController = GetComponent <RaycastController>(); spriteRenderer = GetComponent <SpriteRenderer>(); animator = GetComponent <Animator>(); charSfxPlayer = GetComponent <DinoSoundPlayer>(); }
public void Start() { //base.Start (); rc = GetComponent <RaycastController>(); rc.Start(); collisions.faceDir = 1; }
public UnitSelectionController(InputController inputController, RaycastController raycastController, CoordFinder coordFinder) { this.inputController = inputController; this.raycastController = raycastController; this.coordFinder = coordFinder; }
private void Awake() { if (!instance) { instance = this; } }
void Awake() { if (instance == null) { instance = this; } }
private void Start() { rcController = new RaycastController(GetComponent <BoxCollider2D>()); gravity = -(2 * jumpHeight) / Mathf.Pow(timeToJumpHeight, 2); jumpVelocity = (2 * jumpHeight) / timeToJumpHeight; }
// Start is called before the first frame update void Start() { worldSettings = FindObjectOfType <WorldSettings>(); controller = GetComponent <CharacterController>(); worldSettings = FindObjectOfType <WorldSettings>(); anim = GetComponent <Animator>(); raycast = GetComponent <RaycastController>(); if (raycast != null) { int inventoryLayerMask = 1 << LayerMask.NameToLayer("Enemy"); raycast.AddLayerMask(inventoryLayerMask); } equipper = GetComponent <ItemEquipper>(); attack = GetComponent <PlayerAttack>(); treeController = GetComponent <TreeController>(); cameraAdjuster = GetComponent <CameraAdjuster>(); playerStatistics = GetComponent <PlayerStatistics>(); itemCollector = GetComponent <ItemCollector>(); totalSwingTime = GetSwimgTimeByAnimator(anim); reticleMissColor = reticle.color; }
/* * Resizes the sprite size and the collider size according to the bridge's length */ public void Reload() { bridge.GetComponent <BoxCollider2D>().size = new Vector2(length, bridge.GetComponent <BoxCollider2D>().size.y); bridge.GetComponent <SpriteRenderer>().size = new Vector2(length, bridge.GetComponent <SpriteRenderer>().size.y); bridgeRaycaster = bridge.GetComponentInChildren <RaycastController>(); bridgeRaycaster.Start(); }
private void Awake() { // -- Cria instância para o próprio objeto if (!instance) { instance = this; } }
public CharacterController2D(RaycastController rayController, Transform tran, float maxJump, float minJump, float timetoJump, float MoveSpeed) { raycastController = rayController; _tran = tran; setGravity(); collisions.faceDir = 1; maxJumpHeight = maxJump; minJumpHeight = minJump; timeToJumpApex = timetoJump; moveSpeed = MoveSpeed; }
void Awake() { if (instance == null) { instance = this; } audio = GetComponent <AudioSource>(); }
private void Awake() { raycastController = GetComponent <RaycastController>(); if (raycastController == null) { Debug.LogError("Attach a RaycastController!"); } }
public void OnClick() { PuzzleLogic.ResetPuzzle(); _distance = RaycastController.GetDistanceToCamera(RaycastController.HitInfo.point); _grabLocalPos = transform.InverseTransformPoint(RaycastController.HitInfo.point); _isManipulating = true; UIController.ClickManipulatable(); }
public UnitDragController(RaycastController raycastController, CoordFinderBySelectedPlayer coordFinderBySelectedPlayer, InputController inputController, UnitSelectionController unitSelectionController, IPredicate <UnitSelectedEvent> canStartDrag) { this.raycastController = raycastController; this.canStartDrag = canStartDrag; this.coordFinderBySelectedPlayer = coordFinderBySelectedPlayer; this.inputController = inputController; this.unitSelectionController = unitSelectionController; }
protected void Start() { rcController = new RaycastController(GetComponent <BoxCollider2D>()); globalWaypoints = new Vector3[localWaypoints.Length]; for (int i = 0; i < localWaypoints.Length; i++) { globalWaypoints[i] = localWaypoints[i] + transform.position; } }
// Called before Start private void Awake() { raycastController = GetComponent <RaycastController>(); spriteRenderer = GetComponent <SpriteRenderer>(); animator = GetComponent <Animator>(); rBody = GetComponent <Rigidbody2D>(); maxHealth = health; maxStamina = stamina; //charSfxPlayer = GetComponent<DinoSoundPlayer>(); }
// Use this for initialization void Start() { rc = GetComponent <RaycastController> (); render = GetComponent <SpriteRenderer> (); animator = GetComponent <Animator> (); health = 3; //Kinematic formula, solve for acceleration going down gravity = -(2 * 2.5f) / Mathf.Pow(0.36f, 2); }
private void Start() { m_RaycastController = GetComponent <RaycastController> (); m_GlobalWaypoints = new Vector3[m_LocalWaypoints.Length]; for (int i = 0; i < m_LocalWaypoints.Length; i++) { m_GlobalWaypoints [i] = m_LocalWaypoints [i] + transform.position; } }
void Start() { rbw = whiteBall.GetComponent <Rigidbody>(); rbr = whiteBall.GetComponent <Rigidbody>(); rby = whiteBall.GetComponent <Rigidbody>(); rayCont = GetComponent <RaycastController>(); gameObject.GetComponent <Rigidbody>(); //maxspeed =powerSlider.maxValue; }
// Use this for initialization void Start() { rc = GetComponent <RaycastController>(); rc.Start(); globalWaypoints = new Vector3[localWaypoints.Length]; for (int i = 0; i < localWaypoints.Length; i++) { globalWaypoints[i] = localWaypoints[i] + transform.position; } }
public void FixedUpdate() { if (_isManipulating) { var target = RaycastController.GetPosInCenterOfView(_distance); var grabPoint = transform.TransformPoint(_grabLocalPos); Rigidbody.AddForceAtPosition((target - grabPoint) * ForceMultiplier, grabPoint); Rigidbody.AddForceAtPosition(-Rigidbody.GetPointVelocity(grabPoint) * DampingMultiplier, grabPoint); } }
/// <summary> /// Get the nearest position that we hit. The layers /// culled are the aiming layers in the camera editor /// </summary> /// <param name="distance"> The distance to check </param> /// <returns> /// The position of the nearest hit object straight /// from the camera /// </returns> public RaycastController getNearestStraightLineTarget(float distance) { RaycastController rayController = new RaycastController(start: transform.position, direction: transform.forward, distance: distance, layerMasks: AimingLayers); if (drawRayCasts) { rayController.DrawRay(c: rayColor); } return(rayController); }
// Start is called before the first frame update void Start() { controller = GetComponent <RaycastController>(); renderer = GetComponent <SpriteRenderer>(); gravity = -(2 * maxJumpHeight) / Mathf.Pow(timeToJumpApex, 2); //Kinematic operatin defining deltaMovement (gravity is treated as acceleartion here) maxJumpVelocity = Mathf.Abs(gravity) * timeToJumpApex; //kinematic operation of jump velocity minJumpVelocity = Mathf.Sqrt(2 * Mathf.Abs(gravity) * minJumpHeight); timeUntilDash = 0f; print("Gravity: " + gravity + " Jump Velocity: " + maxJumpVelocity); }
void Awake() { movementController = gameObject.GetComponent <MovementController>(); raycastController = gameObject.GetComponent <RaycastController>(); cameraController = Camera.main.GetComponent <CameraController>(); //cameraViewsControler = gameObject.GetComponent<CameraViewsControler>(); SpawnButtons(); SpawnCameraButton(); SpawnLevelButtons(); }
// Use this for initialization void Start() { boost = new Boost(currentMovementConfig); jump = new Jump(currentMovementConfig); uprightMovement = new UprightMovement(currentMovementConfig); airMovement = new AirMovement(currentMovementConfig); raycaster = GetComponent <RaycastController>(); rb = GetComponent <Rigidbody>(); input = FindObjectOfType <InputController>(); }
/// <summary> /// Check our bullet moving forward /// </summary> /// <returns> /// The location of the hit /// </returns> Vector3 CheckForward() { var d = bulletRay ? bulletRange : (bulletSpeed * Time.deltaTime); RaycastController ray = new RaycastController(start: transform.position, direction: transform.forward, distance: d, layerMasks: LayersToHit); Vector3 distace = ray.StraightLineHit; CheckHit(ray); return(distace); }
private void LoadComponents() { animator = GetComponent <Animator>(); particleSys = GetComponentInChildren <ParticleSystem>(); audioSources = GetComponents <AudioSource>(); audioFire = audioSources[0]; audioReload = audioSources[1]; raycaster = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <RaycastController>(); totalBulletCount = INIT_BULLET_COUNT; clipBulletCount = CLIP_SIZE; leftoverBulletCount = totalBulletCount - clipBulletCount; }
/// <summary> /// Check our hit... see if we hit something /// and if we did if that something had a health manager /// attached to it /// </summary> /// <param name="ray"></param> void CheckHit(RaycastController ray) { if (!ray.FirstObjectHit) { Destroy(gameObject); return; // we hit nothing } foreach (RaycastHit hit in ray.OrderedHits) { if (hit.transform.gameObject.GetComponent <IBulletInteract>() != null) { var ibi = hit.transform.GetComponent <IBulletInteract>(); if (onHit != null) { onHit.Invoke(false); } if (ibi.OnBulletImpact(this)) { break; } } else if (hit.transform.gameObject.GetComponent <AsteriaHealth.HealthManager>() != null) { var healthManager = hit.transform.gameObject.GetComponent <AsteriaHealth.HealthManager>(); foreach (RaycastHit hits in ray.OrderedHits) { foreach (AsteriaHealth.HealthItem hi in healthManager.HealthItems) { if (hi.gameObject == hits.collider.gameObject) { if (onHit != null) { onHit.Invoke(true); } hi.TakeDamage(damage: DoDamage, origin: Owner, hitBy: gameObject); break; } } } } else { createGenericImpactActions(); break; } } Destroy(gameObject); }
private void Awake() { if (player == null) { player = GameObject.FindGameObjectWithTag("Player"); } _ray = GetComponent <CharacterController2D>(); _pathAgent = GetComponent <PathfindingAgent>(); if (_pathScript == null) { _pathScript = GameObject.FindGameObjectWithTag("GameController").GetComponent <Pathfinding>(); } }