private void PerformTeleportation() { candidateDestinations.Clear(); foreach (GroundSensor destination in teleportDestinations) { destination.gameObject.SetActive(false); if (!destination.contact) { candidateDestinations.Add(destination); } } if (candidateDestinations.Count == 0) { return; } energyResource.Spend(teleportEnergyCost); GroundSensor randomDestination = candidateDestinations[Random.Range(0, candidateDestinations.Count)]; Missile sourceEffect = Instantiate(teleportationSourceEffect, transform.position, transform.rotation); transform.position = randomDestination.transform.position; transform.rotation = randomDestination.transform.rotation; Missile destinationEffect = Instantiate(teleportationSourceEffect, transform.position, transform.rotation); teleportReloadTimer.Start(teleportReload); }
private void Awake() { animator = GetComponentInChildren <Animator>(); if (animator == null) { throw new System.Exception("Player Movement - Need Animator"); } speed = defaultSpeed; controller = GetComponent <CharacterController>(); if (controller == null) { throw new System.Exception("Player Movement - Need CharacterController"); } groundSensor = GetComponentInChildren <GroundSensor>(); if (groundSensor == null) { throw new System.Exception("Player Movement - Need GroundSensor"); } if (health == null) { throw new System.Exception("Player Movement - Need health"); } if (!debug) { StartCoroutine(StartRunning()); } }
void Start() { _isAliveComponent = GetComponent <IsAliveComponent>(); _playerAnimator = GetComponent <Animator>(); playerBody2D = GetComponent <Rigidbody2D>(); _playerGroundSensor = transform.Find("Ground Sensor").GetComponent <GroundSensor>(); _playerObjectLayer = LayerMask.NameToLayer("Player"); _enemyObjectLayer = LayerMask.NameToLayer("Enemy"); _specialPlatformLayer = LayerMask.NameToLayer("Special Platform"); }
void Start() { m_animator = GetComponent <Animator>(); m_body2d = GetComponent <Rigidbody2D>(); m_groundSensor = transform.Find("GroundSensor").GetComponent <GroundSensor>(); rageBar = GameObject.Find("Rage").GetComponent <Image>(); lifeBar = GameObject.Find("Life").GetComponent <Image>(); health = maxHealth; rageBar.fillAmount = 0.0f; }
void Start() { m_animator = GetComponent <Animator>(); m_body2d = GetComponent <Rigidbody2D>(); m_groundSensor = transform.Find("GroundSensor").GetComponent <GroundSensor>(); rageBar = GameObject.Find("Rage").GetComponent <Image>(); lifeBar = GameObject.Find("Life").GetComponent <Image>(); timerText = GameObject.Find("TimerText").GetComponent <Text>(); health = maxHealth; rageTime = maxRageTime; }
// Start is called before the first frame update void Start() { rigidBody = GetComponent <Rigidbody>(); IsJumping = false; doubleJumpCount = 0; groundSensor = gameObject.GetComponentInChildren <GroundSensor>(); if (!groundSensor) { Debug.LogWarning("Jumping Script not paired with a GroundSensor... Ground detection will be replaced by velocity analysis and will be less responsive... SetOnGround can be call to improve responsiveness"); } }
private void Awake() { controller = GetComponent <CharacterController>(); if (controller == null) { throw new System.Exception("Enemy Movement - Need CharacterController"); } if (usePhysics) { groundSensor = GetComponentInChildren <GroundSensor>(); if (groundSensor == null) { throw new System.Exception("Enemy Movement - Need GroundSensor"); } } }
/// <summary> /// Erstellt die Für den Test nötigen Objekte. /// </summary> public void TestSolve() { //Robot1 GameObject robot1Object = robotManager.CreateRobot(-6, 3); robotManager.TurnRobotStartingDirection(robot1Object); robotManager.TurnRobotStartingDirection(robot1Object); ShreddingTool tool1 = new ShreddingTool(robot1Object.GetComponent <Robot>()); BasicLeg leg1 = new BasicLeg(robot1Object.GetComponent <Robot>()); TextAsset text = Resources.Load <TextAsset>("Texts/Robot 1Actions"); string scriptCode = text.text; robot1Object.GetComponent <Robot>().ChangeScriptCode(scriptCode); //Robot2 GameObject robot2Object = robotManager.CreateRobot(-7, 5); BasicArm tool2 = new BasicArm(robot2Object.GetComponent <Robot>()); SpiderLeg leg2 = new SpiderLeg(robot2Object.GetComponent <Robot>()); BasicSensor sensor2 = new BasicSensor(robot2Object.GetComponent <Robot>()); text = Resources.Load <TextAsset>("Texts/Robot 2Actions"); scriptCode = text.text; robot2Object.GetComponent <Robot>().ChangeScriptCode(scriptCode); //Robot3 GameObject robot3Object = robotManager.CreateRobot(-7, 2); robotManager.TurnRobotStartingDirection(robot3Object); robotManager.TurnRobotStartingDirection(robot3Object); BasicArm tool3 = new BasicArm(robot3Object.GetComponent <Robot>()); Boat leg3 = new Boat(robot3Object.GetComponent <Robot>()); BasicSensor sensor3 = new BasicSensor(robot3Object.GetComponent <Robot>()); GroundSensor sensor3_2 = new GroundSensor(robot3Object.GetComponent <Robot>()); text = Resources.Load <TextAsset>("Texts/Robot 3Actions"); scriptCode = text.text; robot3Object.GetComponent <Robot>().ChangeScriptCode(scriptCode); //Robot4 GameObject robot4Object = robotManager.CreateRobot(-7, -2); robotManager.TurnRobotStartingDirection(robot4Object); robotManager.TurnRobotStartingDirection(robot4Object); BasicArm tool4 = new BasicArm(robot4Object.GetComponent <Robot>()); BasicLeg leg4 = new BasicLeg(robot4Object.GetComponent <Robot>()); BasicSensor sensor4 = new BasicSensor(robot4Object.GetComponent <Robot>()); text = Resources.Load <TextAsset>("Texts/Robot 4Actions"); scriptCode = text.text; robot4Object.GetComponent <Robot>().ChangeScriptCode(scriptCode); //Robot5 GameObject robot5Object = robotManager.CreateRobot(-2, -3); robotManager.TurnRobotStartingDirection(robot5Object); BasicArm tool5 = new BasicArm(robot5Object.GetComponent <Robot>()); SpiderLeg leg5 = new SpiderLeg(robot5Object.GetComponent <Robot>()); BasicSensor sensor5 = new BasicSensor(robot5Object.GetComponent <Robot>()); text = Resources.Load <TextAsset>("Texts/Robot 5Actions"); scriptCode = text.text; robot5Object.GetComponent <Robot>().ChangeScriptCode(scriptCode); //Robot6 GameObject robot6Object = robotManager.CreateRobot(4, -1); WeldingTool tool6 = new WeldingTool(robot6Object.GetComponent <Robot>()); SpiderLeg leg6 = new SpiderLeg(robot6Object.GetComponent <Robot>()); BasicSensor sensor6 = new BasicSensor(robot6Object.GetComponent <Robot>()); Scanner sensor6_2 = new Scanner(robot6Object.GetComponent <Robot>()); text = Resources.Load <TextAsset>("Texts/Robot 6Actions"); scriptCode = text.text; robot6Object.GetComponent <Robot>().ChangeScriptCode(scriptCode); //Robot7 GameObject robot7Object = robotManager.CreateRobot(0, -1); robotManager.TurnRobotStartingDirection(robot7Object); robotManager.TurnRobotStartingDirection(robot7Object); robotManager.TurnRobotStartingDirection(robot7Object); BasicArm tool7 = new BasicArm(robot7Object.GetComponent <Robot>()); SpiderLeg leg7 = new SpiderLeg(robot7Object.GetComponent <Robot>()); BasicSensor sensor7 = new BasicSensor(robot7Object.GetComponent <Robot>()); text = Resources.Load <TextAsset>("Texts/Robot 7Actions"); scriptCode = text.text; robot7Object.GetComponent <Robot>().ChangeScriptCode(scriptCode); }
// Use this for initialization void Start() { m_animator = GetComponent <Animator>(); m_body2d = GetComponent <Rigidbody2D>(); m_groundSensor = transform.Find("GroundSensor").GetComponent <GroundSensor>(); }
private int energy = 0;//provisional void Awake() { rigidbody = GetComponent <Rigidbody>(); groundSensor = GetComponentInChildren <GroundSensor>(); }