void Start() { cs = this.GetComponent<CharacterScript>(); ms = this.GetComponent<MovementScript>(); likes = new ArrayList(); ts = GameObject.FindGameObjectWithTag("Grid").GetComponent<TileScript>(); }
void Awake() { turretASource = GetComponent<AudioSource> (); muzzleLight = muzzleflash.GetComponent<Light> (); muzzlerenderer = muzzleflash.GetComponent<MeshRenderer> (); turretParticleSys = turret.GetComponent<ParticleSystem> (); playerScript = player.GetComponent<MovementScript> (); }
void Start() { ps = this.GetComponent<PoofScript>(); ms = this.GetComponent<MovementScript>(); //mostRecent = Direction.Stay; likes = new ArrayList(); }
void Start() { OnLevelWasLoaded (); // Because unity doesn't call OnLevelWasLoaded when starting a Scene. Script3D = gameObject.GetComponent<MovementScript> (); transSwitch = gameObject.GetComponent<OpagueScript> (); mouseScript = gameObject.GetComponent<MouseTorque> (); YouAreHere = GameObject.FindGameObjectWithTag ("YouAreHere"); YouAreHere.gameObject.SetActive (false); }
public Player(ActorManager actorManager, PuzzleEngineAlpha.Level.TileMap tileMap, PuzzleEngineAlpha.Camera.Camera camera, Vector2 location, Texture2D texture, float step, int frameWidth, int frameHeight, int collideWidth, int collideHeight) : base(tileMap, camera, location, frameWidth, frameHeight, collideWidth, collideHeight) { this.InitialLocation = location; this.animations.Add("run", new PuzzleEngineAlpha.Animations.AnimationStrip(texture, frameWidth, "run")); currentAnimation = "run"; this.step = step; movementScript = new MovementScript(); movementState = 0; this.actorManager = actorManager; this.IsActive = false; tranparencyTransition = new PuzzleEngineAlpha.Animations.SmoothTransition(1.0f, 0.001f, 0.6f, 1.0f); IsActive = false; Interaction = false; }
public static void LoadMovementScripts(bool reload = false) { if (!Directory.Exists(ConfigUtil.MovementScriptsDir)) { Directory.CreateDirectory(ConfigUtil.MovementScriptsDir); } else { var loadedNames = new List <string>(); foreach (var cam in Directory.GetFiles(ConfigUtil.MovementScriptsDir, "*.json")) { try { var name = Path.GetFileNameWithoutExtension(cam); var script = MovementScript.Load(name); if (script.frames.Count() < 2) { throw new Exception("Movement scripts must contain at least two keyframes"); } #if DEBUG Plugin.Log.Info($"Loaded Movement script {name}"); Plugin.Log.Info($"Sync to song: {script.syncToSong}"); Plugin.Log.Info($"Duration: {script.scriptDuration} ({script.frames.Count()} frames)"); #endif movementScripts[name] = script; if (reload && script != null) { loadedNames.Add(name); } } catch (Exception ex) { Plugin.Log.Error($"Failed to load Movement script {Path.GetFileName(cam)}"); Plugin.Log.Error(ex); } } if (reload) { foreach (var deletedScript in movementScripts.Where(x => !loadedNames.Contains(x.Key))) { movementScripts.Remove(deletedScript.Key); } } } }
int curItem; // place in item array void Start() { entity = GetComponent <Transform>().gameObject; movement = GetComponent <MovementScript>(); isSolid = true; weaponSpot = transform.FindChild("GunSpot").gameObject; gun = Instantiate(startGun, weaponSpot.transform.position, weaponSpot.transform.rotation) as GameObject; gun.transform.parent = weaponSpot.transform; gun.SetActive(true); gunArray.Add(gun); curGun = 0; attack = 0; MAX_ATTACK = 0; // set to different attack }
IEnumerator EnableSpeedTemporarily() { notificationText.SetActive(true); this.gameObject.GetComponent <Image>().enabled = false; GameObject player = GameObject.Find("Player"); MovementScript playerMovement = player.GetComponent <MovementScript>(); playerMovement.playerSpeed += value; GetComponent <AudioSource>().Play(); yield return(new WaitForSeconds(5)); playerMovement.playerSpeed -= value; notificationText.SetActive(false); powerUp.SetActive(false); }
void Start() { deathParticles = GetComponent <ParticleSystem>(); playerMov = GetComponent <MovementScript>(); playerWeapon = GetComponent <WeaponControl>(); playerSprite = GetComponent <SpriteRenderer>(); playerTransform = GetComponent <Transform>(); if (playerClass == PlayerClass.Knight) { knightController = GetComponent <KnightStateController>(); } if (playerClass == PlayerClass.BasicGuy) { basicGuyController = GetComponent <BasicGuyStateController>(); } }
public void PlayerScore() { MovementScript playerScripts = player.GetComponent <MovementScript>(); if (playerScripts.depression <= 0) { Time.timeScale = 0; WinMenu.SetActive(true); player.SetActive(false); timer = Mathf.Round(timer * 100f) / 100f; timeText.text = "You survived for " + timer.ToString() + " seconds."; } else { timer += Time.deltaTime; } }
// Use this for initialization void Start() { // Grabbing the player gameobject player = GameObject.FindGameObjectWithTag("Player"); // Linking the scripts movScript = GameObject.FindGameObjectWithTag("Player").GetComponent <MovementScript>(); // Grab the platforms and assign them to the array of game objects, listOfPlatforms platforms = GameObject.FindGameObjectWithTag("platforms"); // Populate and initialize the array of platforms listOfPlatforms = new GameObject[6]; platformsOrgPosition = new Vector3[6]; // Fill the listOfPlatforms array with the children of platforms PopulatePlatforms(); // Choosing platforms variables isFirstPlatformActive = false; newPlatformStartPoint = 0; // Platform type variable initialization normalTileCount = 0; encampmentTileCount = 0; platformType = 0; encampmentChance = 10; normalChance = 90; coinChance = 80; typeToBe = 0; // Chance this variable for difficulty maxEncampmentCount = 3; // Lerp variable initialization lerpTime = 0; rateOfLerp = 1.5f; disBeforeComplete = 0.25f; isLerping = false; newPosition = new Vector3(0, 0, 0); orgPosition = listOfPlatforms[0].transform.position; leftPosition = new Vector3(listOfPlatforms[0].transform.position.x + 4, listOfPlatforms[0].transform.position.y, listOfPlatforms[0].transform.position.z); centerPosition = new Vector3(listOfPlatforms[0].transform.position.x, listOfPlatforms[0].transform.position.y, listOfPlatforms[0].transform.position.z); rightPosition = new Vector3(listOfPlatforms[0].transform.position.x - 4, listOfPlatforms[0].transform.position.y, listOfPlatforms[0].transform.position.z); newPlatformPositions = new Vector3[6]; // Stance variables encampmentTracker = 0; // GENERATE PLATFORMS // Call function to start making the path GeneratePlatforms(); // Subscribe to event Subscribe(movScript); }
// OnStateEnter is called before OnStateEnter is called on any state inside this state machine override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { // Init current level controller. levelController = LevelController.GetCurrentLevelController(); if (stateInfo.IsName("Walk")) { levelController.OnStartPlayerWalking(); //disable movement of the cam when the prof is visible CameraFollowPlayer camera = FindObjectOfType <CameraFollowPlayer>(); if (camera != null) { camera.EnableMovement(false); } } if (stateInfo.IsName("Jump")) { MovementScript ms = FindObjectOfType <MovementScript>(); if (ms != null) { ms.StopJumping(); } } if (stateInfo.IsName(("Idle"))) { if (levelController != null) { if (levelController.levelStart) { levelController.levelStart = false; } else { levelController.OnEnterPlayerIdle(); } } } if (stateInfo.IsName("DrinkBeer")) { FindObjectOfType <PlayerController>().SetDrinking(true); } if (stateInfo.IsName("ThrowBeer")) { FindObjectOfType <PlayerController>().StopThrowBeer(); } }
IEnumerator OnTriggerEnter2D(Collider2D collision) { MovementScript playerJump = Neo.GetComponent <MovementScript>(); if (collision.tag == "Player") { BoosterSound.Play(); gameObject.GetComponent <Renderer>().enabled = false; Neo.GetComponent <MovementScript>().JumpStrength = 10f; //Debug.Log("Coroutine Started"); yield return(new WaitForSeconds(_BOOSTER_DURATION)); //Debug.Log("Coroutine Ended"); Neo.GetComponent <MovementScript>().JumpStrength = 6.0f; Destroy(gameObject); } }
private void OnTriggerEnter(Collider other) { MovementScript obj = other.gameObject.GetComponent <MovementScript>(); if (obj != null) { if (id == obj.id) { //Debug.Log("HI THERE"); objective = obj; objectivePos = obj.transform.position; contactTime = Time.time; obj.SetVelocity(Vector3.zero); obj.enabled = false; obj.gameObject.GetComponent <Rigidbody>().isKinematic = true; } } }
// Update is called once per frame void Update() { healthBar.fillAmount = (float)health / maxHealth; if (health < 0) { MovementScript comp = GetComponent <MovementScript>(); if (comp.enabled) { comp.enabled = false; animator.SetBool("Dead", true); for (int i = 0; i < transform.childCount; i++) { transform.GetChild(i).gameObject.AddComponent <Rigidbody>(); StartCoroutine(Reload(5.0f)); } } } }
private void View_InvokeRunScript(object sender, MovementScript e) { try { var isAtPosition = movement.IsNowAtPosition(e.Start); if (!isAtPosition && messageService.ShowExclamation("Перед началом выполнения сценария робот будет перемещен в начальное положение") != UserResponse.OK) { return; } scriptExecutor.Execute(e, false); } catch (Exception ex) { messageService.ShowError(ex.Message); } }
public void Init(bool started) { ms = GameObject.FindGameObjectWithTag("Player").GetComponent <MovementScript>(); mobscript = GameObject.Find("Mobs").GetComponent <MobMovement>(); gs = GameObject.FindGameObjectWithTag("Canvas").GetComponent <GameStart>(); ha = GameObject.Find("Humans").GetComponent <HumanAI>(); hitsource = GameObject.Find("HitSound").GetComponent <AudioSource>(); brainsource = GameObject.Find("BrainSound").GetComponent <AudioSource>(); humandeathsource = GameObject.Find("HumanDeathSound").GetComponent <AudioSource>(); zombiedeathsource = GameObject.Find("ZombieDeathSound").GetComponent <AudioSource>(); mobsource = GameObject.Find("MobSound").GetComponent <AudioSource>(); hitsource.clip = hitaudio; brainsource.clip = brainaudio; humandeathsource.clip = humandeathaudio; zombiedeathsource.clip = zombiedeathaudio; control = GetComponent <CharacterController>(); anim = GetComponent <Animator>(); begin = true; }
public CharacterScript(MovementScript movementScript, LookScript lookScript, WeaponScript weaponScript, AiScript aiScript, GameObject weapon, InvincibleScript invincibleScript, GameObject parent) { _weapon = weapon; parent.AddScript(this); _parent.AddScript(movementScript); _parent.AddScript(lookScript); _parent.AddScript(weaponScript); if (invincibleScript != null) { _parent.AddScript(invincibleScript); } if (aiScript != null) { _parent.AddScript(aiScript); } weapon.AddComponent(weaponScript.GetTextureComponent()); }
void Start() { scaleAmount = transform.localScale.x; int score = lifeCost * PlayerStats.Current.Level / 10; deathHandler = new DeathHandler(); deathHandler.AddAction(delegate { PlayerStats.Current.Score += score; }); deathHandler.AddAction(delegate { PlayerStats.Current.IncreaseLevel(lifeCost / 10); }); deathHandler.AddAction(delegate { if (scaleAmount == 10.0f) { PlayerStats.Current.Money += 1; } }); deathHandler.AddAction(delegate { Canvas canvasChild = GetComponentInChildren <Canvas>(true); if (canvasChild) { canvasChild.gameObject.SetActive(true); Text lifeCostChild = canvasChild.GetComponentInChildren <Text>(); if (lifeCostChild) { lifeCostChild.text = score.ToString(); } } }); deathHandler.AddAction(delegate { if (meteorSoundExplodeInAir && SettingsScript.EffectVolume > 0.01f) { meteorSoundExplodeInAir.volume = SettingsScript.EffectVolume * transform.localScale.x / 100; meteorSoundExplodeInAir.Play(); } }); deathHandler.AddAction(delegate { if (transform.localScale.x == 10 && coinSound && SettingsScript.EffectVolume > 0.01f) { coinSound.Play(); } }); animController = gameObject.GetComponent <Animator>(); movement = gameObject.GetComponent <MovementScript>(); }
private void View_InvokeRemoveScript(object sender, MovementScript e) { if (scriptExecutor.IsExecuting) { return; } try { if (messageService.ShowExclamation("Вы действительно хотите удалить сценарий «" + e.Name + "»") == UserResponse.OK) { scripts.Remove(e); view.SetScriptsList(scripts); } } catch (Exception ex) { messageService.ShowError(ex.Message); } }
void Start() { numberOfHearts = hearts.Length; thePlayer = GetComponent <MovementScript> (); playerbody = GetComponent <Rigidbody2D> (); spriteRenderer = GetComponent <SpriteRenderer> (); /* Taylor: Checks to see if game is being loaded or if it is on Level02(or a different level). * Basically, checks to see if its a new game. * Otherwise, since it is the first instance of PlayersCurrentState, it would show 0 hearts, * activating the death sound effect and reseting. Once we add the level03 scene, we will need to change to * (GameManager.Instance.LoadingScene != true && (SceneManager.GetActiveScene().buildIndex == 3 || SceneManager.GetActiveScene().buildIndex == 4)) */ if (SaveLoad.Instance.LoadingScene != true && SceneManager.GetActiveScene().buildIndex == 3) { if (GameManager.Instance.localData.Health < hearts.Length) { SetupScene(GameManager.Instance.localData.Health); } } }
private void View_InvokeMoveToStartScript(object sender, MovementScript e) { try { if (e == null) { return; } if (messageService.ShowExclamation("Переместить манипулятор в начальную точку сценария «" + e.Name + "»") == UserResponse.OK) { var action = new Action(() => messageService.ShowMessage("Робот перемещен в начальную точку сценария «" + e.Name + "»")); movement.MoveRobotByPath(e.Start, action); } } catch (Exception ex) { messageService.ShowError(ex.Message); } }
void OnTriggerEnter2D(Collider2D other) { GetComponent <AudioSource> ().playOnAwake = false; GetComponent <AudioSource> ().clip = pickup; if (other.gameObject.CompareTag("Pickup")) { other.gameObject.SetActive(false); GetComponent <AudioSource> ().Play(); gos = GameObject.FindGameObjectsWithTag("Pickup"); if (gos.Length == 0) { background.GetComponent <AudioSource>().Stop(); gameWinText.SetActive(true); scoreText.SetActive(true); MovementScript playerMovement = gameObject.GetComponent <MovementScript>(); playerMovement.playerSpeed = 0; GameObject timmer = GameObject.Find("timeInSec"); TimeManager tm = timmer.GetComponent <TimeManager>(); tm.updateOn = false; StartCoroutine(WaitForNewLevel()); } } if (other.gameObject.tag.Contains("Powerup")) { GameObject powerUp = null; foreach (PowerUpEntry entry in powerUps) { if (other.gameObject.tag.Equals(entry.powerUpTag)) { powerUp = entry.powerUpController; } } other.gameObject.SetActive(false); powerUp.SetActive(true); GetComponent <AudioSource> ().Play(); } }
// Start is called before the first frame update void Start() { // Getting all allied AI units. allyAgents = new List <GameObject>(); GameObject[] agents = GameObject.FindGameObjectsWithTag("Enemy"); for (int i = 0; i < agents.Length; i++) { allyAgents.Add(agents[i]); } noOfAgents = allyAgents.Count; coverFinder = gameObject.GetComponent <CoverFinderScript>(); movementScript = gameObject.GetComponent <MovementScript>(); agentScript = gameObject.GetComponent <AgentScript>(); emotion = gameObject.GetComponent <EmotionScript>(); player = GameObject.FindGameObjectWithTag("Player"); playerScript = player.GetComponent <PlayerScript>(); decisionTimer = 0.0f; }
// Use this for initialization void Start() { player = FindObjectOfType <MovementScript>(); npcAudio = FindObjectOfType <NPCAudio>(); dialogue = Dialogue.LoadDialogue(new System.IO.StringReader(dialogueFile.text)); journal = FindObjectOfType <Journal>(); var canvas = GameObject.Find("Canvas"); dialogue_window = Instantiate <GameObject>(DialogueWindowPrefab); dialogue_window.transform.SetParent(canvas.transform, false); dialogue_window.SetActive(true); RectTransform dialogue_window_transform = (RectTransform)dialogue_window.transform; dialogue_window_transform.localPosition = new Vector3(0, -170, 0); node_text = GameObject.Find("NPC_Response"); option_1 = GameObject.Find("Button_Option1"); option_2 = GameObject.Find("Button_Option2"); option_3 = GameObject.Find("Button_Option3"); player_name = GameObject.Find("Player_Name"); npc_name = GameObject.Find("NPC_Name"); npc_name.GetComponentInChildren <Text>().text = dialogue.npcName; clue_name = npc_name.GetComponentInChildren <Text>().text; clue_description = dialogue.clue; player_name.SetActive(false); option_1.SetActive(false); option_2.SetActive(false); option_3.SetActive(false); dialogue_window.SetActive(false); }
// Use this for initialization void Start() { animator = this.GetComponent <Animator> (); hostile = false; startHostileTimer = false; thisRB = gameObject.GetComponent <Rigidbody2D> (); timer = 0f; hostileTimer = 0f; duration = 2f; ms = GetComponent <MovementScript> (); if (startsRight) { Debug.Log("Start Right"); isCrawlingRight = true; transform.rotation = Quaternion.Euler(0, 0, 0); } else { isCrawlingRight = false; Debug.Log("Start Left"); transform.rotation = Quaternion.Euler(0, 180, 0); } }
IEnumerator AttackRoutine() { MovementScript movMan = GetComponentInParent <MovementScript> (); WeaponManager wepMan = GetComponentInParent <WeaponManager> (); laserSightGO.SetActive(true); movMan.move_mult = .5f; for (float f = 0; f < startdelay * attackSpeedRed; f += 1f) { Debug.Log("RUNNING: " + f); if (wepMan.iWeapon != 0) { if (h != 0f || v != 0f) { transform.rotation = Quaternion.Euler(new Vector3(0f, 0f, Mathf.Atan2(-v, h) * Mathf.Rad2Deg)); saveH = h; saveV = v; } } transform.localScale = new Vector3(transform.localScale.x, transform.localScale.y, transform.localScale.z); yield return(new WaitForSeconds(.016f)); } movMan.move_mult = 1f; updateInput = (wepMan.iWeapon != 0); h = saveH; v = saveV; base.Attack(); updateInput = true; if (currentBullet != null) { currentBullet.GetComponent <LaserBulletScript> ().RotateParticles(); } Debug.Log("Ended"); laserSightGO.SetActive(false); coroutineHasStarted = false; }
// Use this for initialization void Start() { startPosition = false; charMove = player.GetComponent <MovementScript>(); }
void Start() { movref = this.GetComponent <MovementScript> (); }
// Use this for initialization void Start() { player = GameObject.Find("playerShip").GetComponent <MovementScript>(); }
// Start is called before the first frame update void Start() { decisionMaking = gameObject.GetComponent <DecisionMakingScript>(); movementScript = gameObject.GetComponent <MovementScript>(); agentScript = gameObject.GetComponent <AgentScript>(); }
// Use this for initialization private void Start() { playerMovement = GameObject.FindGameObjectWithTag(StringCollection.TAG_PLAYER).GetComponent <MovementScript>(); }
void Start() { ds = GameObject.FindObjectOfType <DragonSoundPlayer> (); Scene currentScene = SceneManager.GetActiveScene(); if (currentScene.name != "end_game") { cs = GameObject.FindObjectOfType <CameraScript> (); ms = GameObject.FindObjectOfType <MovementScript> (); player = GameObject.FindGameObjectWithTag("Player"); /* Resolutions Dropdown Initialization */ resolutionsDropdown = GameObject.FindGameObjectWithTag("ResolutionsDropdown").GetComponent <TMP_Dropdown>(); resolutionsDropdown.ClearOptions(); resolutions = Screen.resolutions; List <string> options = new List <string> (); int currentResolutionValue = 0; for (int i = 0; i < resolutions.Length; i++) { string option = resolutions [i].width + " x " + resolutions [i].height; options.Add(option); if (resolutions [i].width == Screen.currentResolution.width && resolutions [i].height == Screen.currentResolution.height) { currentResolutionValue = i; } } resolutionsDropdown.AddOptions(options); resolutionsDropdown.value = currentResolutionValue; resolutionsDropdown.RefreshShownValue(); /* Quality Dropdown Initialization */ qualityDropdown = GameObject.FindGameObjectWithTag("QualityDropdown").GetComponent <TMP_Dropdown>(); qualityDropdown.value = QualitySettings.GetQualityLevel(); qualityDropdown.RefreshShownValue(); fullscreenToggle = GameObject.FindGameObjectWithTag("FullscreenToggle").GetComponent <Toggle>(); fullscreenToggle.isOn = Screen.fullScreen; float volume = 0; FMODUnity.RuntimeManager.GetBus("bus:/").getVolume(out volume, out volume); volumeSlider = GameObject.FindGameObjectWithTag("VolumeSlider").GetComponent <Slider>(); volumeSlider.value = volume; /* Hides Pause and Setting Menus */ pauseMenu = GameObject.FindGameObjectWithTag("Pause"); settingsMenu = GameObject.FindGameObjectWithTag("Settings"); if (currentScene.name != "main_menu_scene") { pauseMenu.SetActive(false); } settingsMenu.SetActive(false); if (currentScene.name == "main_menu_scene" && !File.Exists(Application.persistentDataPath + "/playerInfo.dat")) { GameObject.FindGameObjectWithTag("ResumeButton").GetComponent <Button>().interactable = false; } } }
// Start is called before the first frame update void Start() { dialogue_q = new Queue <Dialogue>(); player = (MovementScript)GameObject.FindWithTag("Player").GetComponent(typeof(MovementScript)); shooting = (GunFire)GameObject.FindWithTag("Player").GetComponent(typeof(GunFire)); }
// Use this for initialization void Start() { playerMovement=GameObject.Find("Player").GetComponent<MovementScript>(); }
void Start() { entity = GetComponent<Transform>().gameObject; movement = GetComponent<MovementScript>(); isSolid = true; weaponSpot = transform.FindChild("GunSpot").gameObject; gun = Instantiate(startGun, weaponSpot.transform.position, weaponSpot.transform.rotation) as GameObject; gun.transform.parent = weaponSpot.transform; gun.SetActive(true); gunArray.Add(gun); curGun = 0; attack = 0; MAX_ATTACK = 0; // set to different attack }
void Awake() { anim = GetComponent<Animator> (); healthscript = player.GetComponent<MovementScript> (); }
//ADD: Magic void Awake() { //initialize all component variables Stats = GetComponent<AttributesScript>(); KnownAbilities = GetComponent<CharacterKnownAbilities>(); Status = GetComponent<CharacterStatus>(); Equipment = GetComponent<CharacterEquipment>(); Move = GameObject.FindGameObjectWithTag("Controller").GetComponent<MovementScript>(); pathFind = GameObject.FindGameObjectWithTag("Controller").GetComponent<PathfindingScript>(); findValid = GameObject.FindGameObjectWithTag("Controller").GetComponent<FindValidPoints>(); Draw = GameObject.FindGameObjectWithTag("Controller").GetComponent<DrawSquaresScript>(); Controller = GameObject.FindGameObjectWithTag("Controller").GetComponent<TurnController>(); Magic = GameObject.FindGameObjectWithTag("Controller").GetComponent<MagicList>(); Skills = GameObject.FindGameObjectWithTag("Controller").GetComponent<SkillList>(); Items = GameObject.FindGameObjectWithTag("ItemManager").GetComponent<AllItemsList>(); if(GetComponent<MouseControlScript>()){ Mouse = GetComponent<MouseControlScript>(); isPlayer = true; } skillSelected = ""; }
void Start() { moveref = this.GetComponent<MovementScript> (); }