void Start() { player = GameObject.FindWithTag("Player").GetComponent <Player>(); movementControl = GameObject.FindWithTag("MoveControl").GetComponent <MovementControl>(); useControl = GameObject.FindWithTag("UseControl").GetComponent <UseControl>(); halo = this.transform.gameObject.GetComponent("Halo"); }
void Awake() { heroInfo = GetComponent <UnitInfo>().Info; msControl = GetComponent <MovementControl>(); msControl.CurrentState = MovementControl.MovementState.MOVE; backgroundTexture = new Texture2D(1, 1, TextureFormat.RGB24, false); backgroundTexture.SetPixel(0, 0, Color.black); backgroundTexture.Apply(); healthTexture = new Texture2D(1, 1, TextureFormat.RGB24, false); healthTexture.SetPixel(0, 0, Color.green); healthTexture.Apply(); playerCamera = Camera.main.transform; //msControl.Target = transform.position; regenTimer = Time.time; cameraDown = new Rect(0, 0, Screen.width, guiSize); cameraUp = new Rect(0, Screen.height - guiSize, Screen.width, guiSize); cameraLeft = new Rect(0, 0, guiSize, Screen.height); cameraRight = new Rect(Screen.width - guiSize, 0, guiSize, Screen.height);; heroMovementControl = GetComponent <MovementControl>(); clickingMarker = Instantiate(Resources.Load("ClickingMarker"), heroMovementControl.Position, Quaternion.identity) as GameObject; clickingMarker.SetActive(false); team = transform.tag; }
void Start() { float speedTweak = Random.value * 0.01f; moveDelegate = new MovementControl(1.1f, 0.6f, BASE_SPEED + speedTweak); chooseNewWanderAction(); }
private void Hourse_MouseRightButtonDown(object sender, MouseButtonEventArgs e) { MovementControl mhourse = sender as MovementControl; hourseposX.Text = "X = " + mhourse.X; hourseposY.Text = "Y = " + mhourse.Y; }
void AttachPlayersInside() { Debug.Log("attach players inside"); _isGravityOn = true; for (int i = 0; i < _switchScript._playersInside.Count; i++) { MovementControl player = _switchScript._playersInside [i]; if (_switchScript._switchColor != MovementControl.PlayerType.PurplePlayer) { if (_switchScript._switchColor != player._playerType) { return; } } player._movementMode = MovementControl.MovementMode.Circle; player.CirclingCenter = transform.position; player.CirclingRadius = _radius; Vector3 dirToPlayer = player.transform.position - transform.position; dirToPlayer.z = 0; float angle = Vector3.Angle(Vector3.up, dirToPlayer); if (dirToPlayer.x < 0) { angle = 360 - angle; } player.CirclingAngle = angle; _playerStartAngles [i] = angle; } }
public void All_Robotic_rover_move_inmars_plateau() { IMatrix plateau = new MarsPlateau(5, 5); IPosition positionfirst = new RoboticPosition(1, 2); IPosition positionsecond = new RoboticPosition(3, 3); var roboticRoverFirst = new RoboticRover(positionfirst, Direction.N, plateau); var roboticRoverSecond = new RoboticRover(positionsecond, Direction.E, plateau); roboticRoverFirst.Move("LMLMLMLMM"); var control = new MovementControl <IRover, IMatrix>(roboticRoverFirst, plateau).RoverInMatrix(); Assert.IsTrue(control); Assert.IsTrue(roboticRoverFirst.Position.X == 1, "First Position X is not true!"); Assert.IsTrue(roboticRoverFirst.Position.Y == 3, "First Position Y is not true!"); Assert.IsTrue(roboticRoverFirst.Direction == Direction.N, "First Direction is wrong!"); roboticRoverSecond.Move("MMRMMRMRRM"); control = new MovementControl <IRover, IMatrix>(roboticRoverSecond, plateau).RoverInMatrix(); Assert.IsTrue(control); Assert.IsTrue(roboticRoverSecond.Position.X == 5, "Second Position X is not true!"); Assert.IsTrue(roboticRoverSecond.Position.Y == 1, "Second Position Y is not true!"); Assert.IsTrue(roboticRoverSecond.Direction == Direction.E, "Second Direction is wrong!"); }
new void Awake() { base.Awake(); cooldown = 1f; // 1 second for debug only duration = 15f; movement = GetComponent <MovementControl>(); }
// Start is called before the first frame update void Start() { arrived = false; // movement = gameObject.GetComponent<MovementControl>(); ai = gameObject.GetComponent <AIBehaviour>(); movement = gameObject.GetComponent <MovementControl>(); }
void OnTriggerEnter2D(Collider2D other) { if (other.tag == "Player") { _player = other.GetComponent <MovementControl>(); _hasPlayerLeft = false; } }
void Start() { rb2d = gameObject.GetComponent <Rigidbody2D>(); hand = GameObject.FindGameObjectWithTag("hand"); boulder = GameObject.FindGameObjectWithTag("boulder"); rb2dboulder = boulder.GetComponent <Rigidbody2D>(); movectrl = gameObject.GetComponentInParent <MovementControl>(); }
public WhenNavigating() { var logger = new NullLoggerFactory().CreateLogger("Logger"); var directionControl = new DirectionControl(); var movementControl = new MovementControl(); _navigationControl = new NavigationControl(movementControl, directionControl, logger); }
private void Start() { agent = GetComponentInChildren<NavMeshAgent>(); character = GetComponent<MovementControl>(); agent.updateRotation = false; agent.updatePosition = true; }
void Start() { GM = FindObjectOfType <GameManager>(); mControl = GetComponent <MovementControl>(); InvokeRepeating("CheckPlayerState", 1f, 1f); }
private void Hourse_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { MovementControl mhourse = sender as MovementControl; hourseName.Text = mhourse.HourseName; hourseSpeed.Text = mhourse.Speed.ToString(); hourseroundcount.Text = mhourse.currentCountRound.ToString(); }
public void UpdateStatistics(BaseUnit unit, List <Vector3> points) { GetComponent <UnitInfo>().Info = unit; minionInfo = GetComponent <UnitInfo>().Info; minionInfo.NextAttackTime = Time.time + minionInfo.AttackSpeed; waypoints = points; msControl = GetComponent <MovementControl>(); msControl.UpdateStatistics(); }
// Start is called before the first frame update void Start() { _userDrawnShapePoints = new List <Vector3>(); _userDrawnHullVertices = new List <Vector3>(); _userDrawnHullLines = new List <Vector3[]>(); _currentButtons = new List <GameObject>(); _pointCloudGenerator = GetComponent <PointCloudGenerator>(); movement_control = GetComponent <MovementControl>(); }
void OnTriggerExit2D(Collider2D other) { if (!this.enabled) { return; } if (other.tag == "Player") { MovementControl playerScript = other.GetComponent <MovementControl> (); _playersInside.Remove(playerScript); if (playerScript._playerType != MovementControl.PlayerType.PurplePlayer) { if (!_mustHoldDown) { return; } } if (_switchColor == MovementControl.PlayerType.PurplePlayer) { _isPlayerInside = false; } else if (_switchColor == MovementControl.PlayerType.AnyPlayer) { _isPlayerInside = false; } else { if (_switchColor == playerScript._playerType) { _isPlayerInside = false; } } if (!_isPlayerInside) { if (_switchColor == MovementControl.PlayerType.BluePlayer) { _spriteRenderer.color = new Color(0, 0.5f, 1); } else if (_switchColor == MovementControl.PlayerType.RedPlayer) { _spriteRenderer.color = Color.red; } else if (_switchColor == MovementControl.PlayerType.AnyPlayer) { _spriteRenderer.color = Color.yellow; } else { _spriteRenderer.color = new Color(0.5f, 0, 1); } _isOn = false; } } }
public WhenExecutingMission() { var logger = new NullLoggerFactory().CreateLogger("Logger"); var directionControl = new DirectionControl(); var movementControl = new MovementControl(); var planControl = new PlanControl(logger); var navigationControl = new NavigationControl(movementControl, directionControl, logger); _missionControl = new MissionControl(logger, navigationControl, planControl); }
public void StartingStatistics(Hero info) { GetComponent <UnitInfo>().Info = info; heroInfo = GetComponent <UnitInfo>().Info; heroInfo.Abilities = new SkillData[] { new TestBolt() }; heroInfo.NextAttackTime = Time.time; msControl = GetComponent <MovementControl>(); msControl.UpdateStatistics(); UpdateEffects(); }
public static void StartMoveScale(GameObject target, SkillMoveScaleInfo info) { MovementControl tLockFrame = target.gameObject.GetComponent <MovementControl>(); if (tLockFrame == null) { LogicSystem.GfxLog("StartMoveScale component miss!"); return; } tLockFrame.StartMoveScale(info); }
public static void NotifyIngoreGravity(GameObject target, bool isIngore) { MovementControl mgr = target.GetComponent <MovementControl>(); if (mgr == null) { LogicSystem.GfxLog("NotifyIngoreGravity control miss!"); return; } mgr.NotifyIngoreGravity(isIngore); }
public override void OnEquipped() { isEquipped = true; data = (RocketBootData)itemData; entityMovement = data.ownerEntity.GetComponent <MovementControl>(); entityBody = data.ownerEntity.GetComponent <Rigidbody>(); if (orientation == null) { orientation = transform.parent; } }
public static void StopMove(GameObject target) { MovementControl mgr = target.GetComponent <MovementControl>(); if (mgr == null) { LogicSystem.GfxLog("StartMove movement control miss!"); return; } mgr.StopMove(); }
IEnumerator ChangeSpeed(float speedMultiplier, float duration) { MovementControl mControl = gameObject.GetComponentInChildren <MovementControl>(); if (mControl != null) { mControl.speed *= speedMultiplier; yield return(new WaitForSeconds(duration)); mControl.speed /= speedMultiplier; } }
// Use this for initialization void Start() { cameraDown = new Rect(0, 0, Screen.width, guiSize); cameraUp = new Rect(0, Screen.height - guiSize, Screen.width, guiSize); cameraLeft = new Rect(0, 0, guiSize, Screen.height); cameraRight = new Rect(Screen.width - guiSize, 0, guiSize, Screen.height); heroBehaviour = hero.GetComponent <HeroBehavior>(); heroMovementControl = hero.GetComponent <MovementControl>(); clickingMarker = Instantiate(Resources.Load("ClickingMarker"), heroMovementControl.Position, Quaternion.identity) as GameObject; clickingMarker.SetActive(false); team = "BlueTeam"; }
void Awake() { msControl = GetComponent <MovementControl>(); msControl.UpdateStateInfo(MovementControl.MovementState.STOP); team = gameObject.tag; backgroundTexture = new Texture2D(1, 1, TextureFormat.RGB24, false); backgroundTexture.SetPixel(0, 0, Color.black); backgroundTexture.Apply(); healthTexture = new Texture2D(1, 1, TextureFormat.RGB24, false); healthTexture.SetPixel(0, 0, Color.green); healthTexture.Apply(); }
void Start() { if (player == null) { player = GameObject.FindGameObjectWithTag("Player"); } GM = FindObjectOfType <GameManager>(); if (player != null) { mControl = player.GetComponent <MovementControl>(); health = player.GetComponent <Health>(); score = player.GetComponent <Score>(); if (livesSprite != null) { livesTexture = Misc.GetTextureFromSprite(livesSprite); } if (healthSprite != null) { healthTexture = Misc.GetTextureFromSprite(healthSprite); } if (coinSprite != null) { coinTexture = Misc.GetTextureFromSprite(coinSprite); } if (fireSprite != null) { fireTexture = Misc.GetTextureFromSprite(fireSprite); } if (iceSprite != null) { iceTexture = Misc.GetTextureFromSprite(iceSprite); } } background = new Texture2D(1, 1); background.SetPixel(0, 0, hudBackgroundColor); background.Apply(); hudStyle = new GUIStyle(); hudScale = (int)(Screen.height * hudHeightPercent); padding = new Rect(hudScale / 5, hudScale / 5, hudScale / 5, hudScale / 5); if (font != null) { hudStyle.font = font; } hudStyle.fontSize = (int)(hudScale / 3.125f); hudStyle.normal.textColor = Color.white; }
public void Second_Robotic_rover_move_inmars_plateau() { IMatrix plateau = new MarsPlateau(5, 5); IPosition position = new RoboticPosition(3, 3); var roboticRover = new RoboticRover(position, Direction.E, plateau); roboticRover.Move("MMRMMRMRRM"); var control = new MovementControl <IRover, IMatrix>(roboticRover, plateau).RoverInMatrix(); Assert.IsTrue(control); Assert.IsTrue(roboticRover.Position.X == 5, "Position X is not true"); Assert.IsTrue(roboticRover.Position.Y == 1, "Position Y is not true"); Assert.IsTrue(roboticRover.Direction == Direction.E, "Direction is not true"); }
void Start() { player = GameObject.FindGameObjectWithTag("Player"); mControl = GetComponent <MovementControl>(); rBody = GetComponentInChildren <Rigidbody2D>(); moveDirection = new Vector2(-1, 0); InvokeRepeating("FollowPath", 0, 0.5f); if (player != null && mControl != null) { InvokeRepeating("CheckShooting", 1f, 1 / mControl.shotsPerSecond); } }
void Start() { mControl = parent.GetComponent <MovementControl>(); rBody = GetComponent <Rigidbody2D>(); if (parent.tag == "Enemy") { gameObject.layer = 12; } if (rBody != null && mControl != null) { rBody.AddForce(new Vector2(speedX * mControl.GetFacingDir(), speedY), ForceMode2D.Impulse); } AudioControl.PlayerShootFireball(); //Toistaa äänen }
// Use this for initialization void Start() { msControl = GetComponent <MovementControl>(); UpdateStatistics(new BaseUnit("Minion", transform, "Minion", 250.0, 15, 0, 50, 9, 0.75f, 0f, 20, 5, 0, 2, 2, 2, 0f, 0f, 0f, 0f), new List <Vector3> { new Vector3(15, 0, 0), new Vector3(10, 0, 0), new Vector3(-20, 0, 0) }); msControl.UpdateStateInfo(MovementControl.MovementState.ATTACKMOVE); team = gameObject.tag; backgroundTexture = new Texture2D(1, 1, TextureFormat.RGB24, false); backgroundTexture.SetPixel(0, 0, Color.black); backgroundTexture.Apply(); healthTexture = new Texture2D(1, 1, TextureFormat.RGB24, false); healthTexture.SetPixel(0, 0, Color.green); healthTexture.Apply(); }