//-------------------------------- // 3 - Tirer depuis un autre script //-------------------------------- /// <summary> /// Création d'un projectile si possible /// </summary> public void Attack(bool isEnemy) { if (CanAttack) { shootCooldown = shootingRate; // Création d'un objet copie du prefab var shotTransform = Instantiate(shotPrefab) as Transform; // Position shotTransform.position = transform.position; // Propriétés du script ShotScript shot = shotTransform.gameObject.GetComponent <ShotScript>(); if (shot != null) { shot.isEnemyShot = isEnemy; } // On saisit la direction pour le mouvement MoveScript move = shotTransform.gameObject.GetComponent <MoveScript>(); if (move != null) { move.direction = this.transform.right; // ici la droite sera le devant de notre objet } } }
// Use this for initialization void Start () { //selectieScript.lastGameObjectHit = null; lastHooveredGameObject = null; //Set ref script raycastscript = gameObject.GetComponent("RayCastScript") as RayCastScript; rotateScript = gameObject.GetComponent("RotateScript") as RotateScript; scaleScript = gameObject.GetComponent("ScaleScript") as ScaleScript; stackScript = gameObject.GetComponent("StackScript") as StackScript; moveScript = gameObject.GetComponent("MoveScript") as MoveScript; smoothCameraScript = gameObject.GetComponent("SmoothCameraScript") as SmoothCameraScript; verwijderScript = gameObject.GetComponent("VerwijderScript") as VerwijderScript; selectieScript = gameObject.GetComponent("SelectieScript") as SelectieScript; selectieScript.setSelectionmodeOn(); selectieScript.playerCam = playerCam; //Turn off mouse pointer and set the cursorImage screenpointer = (GUITexture)Instantiate(baseGuiTexture); Screen.showCursor = false; screenpointer.texture = cursorImage; screenpointer.color = Color.red; screenpointer.pixelInset = new Rect(-5, -5,10,10); screenpointer.transform.localScale -= new Vector3(1, 1, 0); modus = Modi.NAV_SEL; }
// Start is called before the first frame update void Start() { us = spawnSubject.GetComponent <UnitScript>(); if (us != null) // If the spawn subject is a unit, just use its values for the card. { hs = spawnSubject.GetComponent <HealthScript>(); ms = spawnSubject.GetComponent <MoveScript>(); cardImage.sprite = spawnSubject.GetComponent <SpriteRenderer>().sprite; outline = GetComponent <Outline>(); hp = hs.hp; cost = us.cost; speed = ms.speed.x; specialText = us.specialText; damage = us.attackDamage; dps = us.attackDamage / us.attackInterval; dps = Mathf.Round(dps * 100f) / 100f; cardText.text = cardScriptTemplate; title.text = us.unitName; cardCost.text = cost.ToString(); } // TODO: If it's not a unit, it's some sort of special effect. We'll need to look elsewhere then for its icon and text, etc. Probably boolean to make custom? }
/// <summary> /// 发射子弹 /// </summary> /// <param name="isEnemy"></param> public void Attack(bool isEnemy) { if (CanAttack) { //if (isEnemy) //{ // SoundEffectsHelper.Instance.MakeEnemyShotSound(); //} else //{ // SoundEffectsHelper.Instance.MakePlayerShotSound(); //} shotCooldown = shotingRate; var shotTransform = Instantiate(shotPrefab) as Transform; shotTransform.position = transform.position; Short shot = shotTransform.gameObject.GetComponent <Short>(); if (shot != null) { shot.isEnemyShot = isEnemy; } MoveScript move = shotTransform.gameObject.GetComponent <MoveScript>(); if (move != null) { move.direction = move.direction; } } }
public void AttackAngled(bool isEnemy, Vector2 direction) { if (direction == new Vector2(0, 0)) { direction = new Vector2(0, 1); } if (CanAttack) { shootCooldown = shootingRate; // Create a new shot var shotTransform = Instantiate(shotPrefab) as Transform; shotTransform.SetParent(gameObject.transform); // Assign position shotTransform.position = transform.position; // The is enemy property ShotScript shot = shotTransform.gameObject.GetComponent <ShotScript>(); if (shot != null) { shot.isEnemyShot = isEnemy; } // Make the weapon shot always towards it MoveScript move = shotTransform.gameObject.GetComponent <MoveScript>(); if (move != null) { //new Vector2((transform.position.x - player.position.x) * speed, (transform.position.y - player.position.y) * speed); move.direction = direction; } } }
//-------------------------------- // 3 - Shooting from another script //-------------------------------- /// <summary> /// Create a new projectile if possible /// </summary> public void Attack(bool isEnemy) { if (CanAttack) { shootCooldown = shootingRate; // Create a new shot var shotTransform = Instantiate(shotPrefab) as Transform; // Assign position shotTransform.position = transform.position; // The is enemy property BulletScript shot = shotTransform.gameObject.GetComponent <BulletScript>(); if (shot != null) { shot.isEnemyShot = isEnemy; } // Make the weapon shot always towards it MoveScript move = shotTransform.gameObject.GetComponent <MoveScript>(); if (move != null) { move.direction = this.transform.up; // towards in 2D space is the right of the sprite } } }
public void Attack(bool isEnemy) { if (CanAttack) { shootCooldown = shootingRate; var shotTransform = Instantiate(shotPrefab) as Transform; shotTransform.position = transform.position; ShotScript shot = shotTransform.gameObject.GetComponent <ShotScript>(); if (shot != null) { shot.isEnemyShot = isEnemy; } MoveScript move = shotTransform.gameObject.GetComponent <MoveScript>(); if (move != null) { // move.direction = player.transform.position.normalized; move.direction = new Vector2(-(this.transform.position.x - player.transform.position.x), -(this.transform.position.y - player.transform.position.y)).normalized; } } }
void Update() { if (Input.GetButtonDown("Cancel")) { StartCoroutine(turnoff()); } if (text.text == sentencesWithShopKeeper[index]) { if (Input.anyKeyDown) { nextSentence(); } } player = GameObject.FindGameObjectWithTag("Player"); if (player != null) { mscr = player.GetComponent <MoveScript>(); } if (gameui.activeInHierarchy == false) { mscr.src.Stop(); Time.timeScale = 0; } else { Time.timeScale = 1; } }
public override void SendMouse1Order(RTSGameObject target, bool directOrder, bool postpone) { if (!postpone) { if (target.GetComponent <Unit>()) { if (target.faction == Faction.Neutral) { Debug.Log("Can't attack this target"); } else if (target.faction != this.faction) { SendMessage("StopAction"); // Interrupt any other actions AttackScript.Attack(target); } } else if (target.GetComponent <Collectable>()) // Goldmine, wood { MoveScript.Move(target.transform.position); } else if (target.GetComponent <CollectableObject>()) // Collectable object { // Take the Object } } else { Orders.AddLast(new Order(OrderName.Mouse1, Vector3.zero, target)); } }
// Update is called once per frame void Update() { UFOTimer -= Time.deltaTime; if (UFOTimer <= 0) { // create UFO at either the left or right side of the screen GameObject UFO = (GameObject)Instantiate(UFOType); MoveScript moveScript = UFO.GetComponent <MoveScript>(); float side = UnityEngine.Random.Range(1.0f, 2.0f); if (side < 1.5) { UFO.transform.position = UFOLeftStart; moveScript.direction = new Vector2(1, 0); } else { UFO.transform.position = UFORightStart; moveScript.direction = new Vector2(-1, 0); } moveScript.speed = UFOSpeed; // set bounds UFOScript ufoScript = UFO.GetComponent <UFOScript>(); ufoScript.leftBound = UFOLeftStart.x; ufoScript.rightBound = UFORightStart.x; // some number around UFOPeriod UFOTimer = UFOPeriod + UnityEngine.Random.Range(-UFOPeriod * 0.2f, UFOPeriod * 0.2f); } }
void Update() { ///* if (Input.GetKey(KeyCode.Alpha1)) { MoveScript.add(1); } else if (Input.GetKey(KeyCode.Alpha2)) { MoveScript.add(2); } else if (Input.GetKey(KeyCode.Alpha3)) { MoveScript.add(3); } else if (Input.GetKey(KeyCode.Alpha4)) { MoveScript.add(4); } else if (Input.GetKey(KeyCode.Alpha5)) { MoveScript.add(5); } else if (Input.GetKey(KeyCode.Alpha6)) { MoveScript.add(-1); } //*/ }
void Start() { player = GameObject.Find("Player"); movescript = player.GetComponent <MoveScript>(); doors = GameObject.Find("GameManager"); arrow = doors.GetComponent <BossRoomBehavior>().arrow; }
public void Attack(bool isEnemy) { if (CanAttack) { shootCooldown = shootingRate; // Create a new shot var shotTransform = Instantiate(shotPrefab) as Transform; // Assign position shotTransform.position = transform.position; // The is enemy property ShotScript shot = shotTransform.gameObject.GetComponent <ShotScript>(); if (shot != null) { shot.isEnemyShot = isEnemy; } // Make the weapon shot always towards it MoveScript move = shotTransform.gameObject.GetComponent <MoveScript>(); if (move != null) { move.direction = this.gameObject.GetComponent <PlayerScript>().movementLeft ? new Vector2(-1, 0) : new Vector2(1, 0); shotTransform.GetComponent <SpriteRenderer>().flipX = move.direction.x < 0; } } }
/// <summary> /// Creates a shot based on the position and rotation of the weapon /// </summary> /// <param name="isEnemy">Whether or not the shot is an enemy's shot</param> public void Shoot(bool isEnemy) { //If the shot cooldown has reached 0 if (shotCooldown <= 0f) { //Reset the shot cooldown shotCooldown = shotRate; //Create a new shot at the position of the weapon var shot = Instantiate(shotPrefab) as Transform; shot.position = new Vector3(transform.position.x, transform.position.y - 0.04f, transform.position.z); shot.eulerAngles = transform.eulerAngles; ShotScript shotScript = shot.gameObject.GetComponent <ShotScript>(); //Sets whether or not the shot is an enemy's or the player's if (shot != null) { shotScript.enemyShot = isEnemy; } //Makes sure the shot moves right relative to the weapon MoveScript movement = shot.gameObject.GetComponent <MoveScript>(); if (movement != null) { movement.direction = shot.transform.right; } } }
//-------------------------------- // 3 - Стрельба из другого скрипта //-------------------------------- /// <summary> /// Создайте новый снаряд, если это возможно /// </summary> public void Attack(bool isEnemy) { if (CanAttack) { shootCooldown = shootingRate; // Создайте новый выстрел var shotTransform = Instantiate(shotPrefab) as Transform; // Определите положение shotTransform.position = transform.position; // Свойство врага ShotScript shot = shotTransform.gameObject.GetComponent <ShotScript>(); if (shot != null) { shot.isEnemyShot = isEnemy; } // Сделайте так, чтобы выстрел всегда был направлен на него MoveScript move = shotTransform.gameObject.GetComponent <MoveScript>(); if (move != null) { move.direction = this.transform.right; // в двухмерном пространстве это будет справа от спрайта } } }
public void Fire(bool isEnemy) { if (CanFire) { _cooldown = shotRate; // Create a new shot var shotTransform = Instantiate(shotPrefab) as Transform; // Assign position shotTransform.position = transform.position; // The is enemy property ShotScript shot = shotTransform.gameObject.GetComponent <ShotScript>(); if (shot != null) { shot.belongsToEnemy = isEnemy; } // Make the weapon shot always towards it MoveScript move = shotTransform.gameObject.GetComponent <MoveScript>(); if (move != null) { move.direction = this.transform.right; // towards in 2D space is the right of the sprite } } }
void Awake() { // Retrieve the weapon only once weapons = GetComponentsInChildren<WeaponScript> (); // Retrieve scripts to disable when not spawn moveScript = GetComponent<MoveScript> (); }
public void TakeDamage() { if (currstate == State.spinningstate) { movescript = player.GetComponent <MoveScript>(); GameObject floatingtextplacehold; movescript = player.gameObject.GetComponent <MoveScript>(); floatingtextplacehold = Instantiate(floatingtext, this.transform.position + new Vector3(0, 0.7f, 0), Quaternion.identity); if (movescript.Damage <= 25) { floatingtextplacehold.GetComponent <TextMesh>().color = Color.yellow; } else if (movescript.Damage > 25 && movescript.Damage <= 75) { Color orange = new Color(0.990566f, 0.6313726f, 0.3490196f, 1); floatingtextplacehold.GetComponent <TextMesh>().color = orange; } else if (movescript.Damage > 75) { floatingtextplacehold.GetComponent <TextMesh>().color = Color.red; } Health -= DAMAGE; floatingtextplacehold.GetComponent <TextMesh>().text = movescript.Damage.ToString(); //TODO: ADD SOUNDS, BLOOD ETC TO TAKING DAMAGE } else { GameObject floatingtextplacehold; floatingtextplacehold = Instantiate(floatingtext, this.transform.position + new Vector3(0, 0.7f, 0), Quaternion.identity); floatingtextplacehold.GetComponent <TextMesh>().text = "Immune"; } BossBar.GetComponent <Slider>().value = Health; return; }
// Shooting from another script // Create new shoot public void Attack(bool isEnemy) { if (CanAttack) { shootCooldown = shootingRate; // Create new shot var shotTransform = Instantiate(shotPrefab) as Transform; // Define position shotTransform.position = transform.position; // Enemy properties ShotScript shot = shotTransform.gameObject.GetComponent <ShotScript>(); if (shot != null) { shot.isEnemyShot = isEnemy; } // Direction to enemy MoveScript move = shotTransform.gameObject.GetComponent <MoveScript>(); if (move != null) { move.direction = this.transform.right; } } }
void Awake() { // Retrieve weapon only once. // This will retrieve the weapon from the child. weapons = GetComponentsInChildren<WeaponScript>(); moveScript = GetComponent<MoveScript>(); }
void Awake() { //加载动画画控制器,移动脚本和武器脚本 animator = GetComponent <Animator> (); moveScript = GetComponent <MoveScript> (); weapon = GetComponentInChildren <WeaponScript> (); }
// Use this for initialization void Start() { //Init controllers wiimote_start(); //Turn off mouse pointer and set the cursorImage screenpointer = (GUITexture)Instantiate(baseGuiTexture); Screen.showCursor = false; screenpointer.texture = cursorImage; screenpointer.color = Color.red; screenpointer.pixelInset = new Rect(10, 10, 10, 10); screenpointer.transform.localScale -= new Vector3(1, 1, 0); //Set ref scripts raycastscript = gameObject.GetComponent("RayCastScript") as RayCastScript; rotateScript = gameObject.GetComponent("RotateScript") as RotateScript; scaleScript = gameObject.GetComponent("ScaleScript") as ScaleScript; stackScript = gameObject.GetComponent("StackScript") as StackScript; moveScript = gameObject.GetComponent("MoveScript") as MoveScript; smoothCameraScript = gameObject.GetComponent("SmoothCameraScript") as SmoothCameraScript; verwijderScript = gameObject.GetComponent("VerwijderScript") as VerwijderScript; selectieScript = gameObject.GetComponent("SelectieScript") as SelectieScript; //Set initial values selectieScript.setSelectionmodeOn(); selectieScript.playerCam = playerCam; modus = Modi.NAV_SEL; }
//Send a wave of enemy, each one going in a random direction void Wave(){ //Sending enemies one by one if(enemyNumber > 0 && enemyCooldown <= 0){ enemyVelocity = 0.0f; float randomEnemyDirection = Random.Range(enemyDirection[0], enemyDirection[1]); float sinAngle = -Mathf.Sin(Mathf.Deg2Rad * randomEnemyDirection); float cosAngle = Mathf.Cos(Mathf.Deg2Rad * randomEnemyDirection); enemyCooldown = enemyRate; enemyNumber--; enemy = Instantiate(enemyPrefab) as Transform; enemy.position = transform.position; //Will pop on the generator enemy.transform.parent = transform.parent; move = enemy.gameObject.GetComponent<MoveScript>(); targetVelocity = move.speed; move.speed *= 3; if(move != null){ move.direction = new Vector2(0 * cosAngle - 1 * sinAngle, 1 * cosAngle + 0 * cosAngle); } } else if(enemyNumber == 0 && enemyCooldown < 0){ //End of the wave Destroy(gameObject); } //Little acceleleration on spawning if(enemyCooldown > 0){ if(move != null){ move.speed = Mathf.SmoothDamp(move.speed, targetVelocity, ref enemyVelocity, enemyRate/2.5f); } } }
public void Attack(bool isEnemy) { if (CanAttack) { shootCooldown = shootingRange; var shotTransform = Instantiate(shotPrefab) as Transform; if (right) { shotTransform.position = new Vector3(transform.position.x + .15f, transform.position.y + .03f, 0f); } else { shotTransform.position = new Vector3(transform.position.x - .15f, transform.position.y + .03f, 0f); } ShotScript shot = shotTransform.gameObject.GetComponent <ShotScript>(); if (shot != null) { shot.isEnemyShot = isEnemy; } MoveScript move = shotTransform.gameObject.GetComponent <MoveScript>(); if (move != null) { if (right) { move.direction = this.transform.right; } else { move.direction = this.transform.right * -1; } } } }
public void Attack(bool isEnemy) { if (CanAttack) { shootCooldown = ShootingRate; if (ShootSound != null) { audio.PlayOneShot(ShootSound); } var shotTransform = Instantiate(ShotPrefab) as Transform; shotTransform.position = transform.position; ShotScript shot = shotTransform.gameObject.GetComponent <ShotScript> (); if (shot != null) { shot.IsEnemyShot = isEnemy; } MoveScript move = shotTransform.gameObject.GetComponent <MoveScript> (); if (move != null) { move.Direction = this.transform.right; move.Speed = BulletSpeed; } } }
public void Attack(bool isEnemy) { if (CanAttack) { shootCoolDown = shootingRate; // создание нового выстрела var shotTransform = Instantiate(shotPrefab) as Transform; //определение положения shotTransform.position = transform.position; //свойство врага ShotScript shot = shotTransform.gameObject.GetComponent <ShotScript>(); if (shot != null) { shot.isEnemyShot = isEnemy; } // направляем выстрел на врага MoveScript move = shotTransform.gameObject.GetComponent <MoveScript>(); if (move != null) { move.direction = this.transform.right; } } }
public void AttackPlayer(bool isEnemy) { //Transform target = GameObject.FindWithTag ("Player").transform; if (CanAttack) { shootCooldown = shootingRate; // Create a new shot var shotTransform = Instantiate(shotPrefab) as Transform; // Assign position shotTransform.position = transform.position; // The is enemy property ShotScript shot = shotTransform.gameObject.GetComponent <ShotScript>(); if (shot != null) { shot.isEnemyShot = isEnemy; } // Make the weapon shot always towards it MoveScript move = shotTransform.gameObject.GetComponent <MoveScript>(); if (move != null) { move.direction = new Vector2((-transform.position.x + Player.transform.position.x) , (-transform.position.y + Player.transform.position.y)).normalized; } } }
void Fire(float axis) { smoke.Smoke(); shootCooldown = shootingRate; var shotobject = Instantiate(projectile) as GameObject; // Assign position shotobject.transform.position = transform.position; ShotScript shot = shotobject.GetComponent <ShotScript>(); if (shot != null) { shot.SetPlayerShoot(this.id); } // Make the weapon shot always towards it MoveScript move = shotobject.GetComponent <MoveScript>(); if (move != null) { move.direction = (facingRight)? this.transform.right : -this.transform.right; // towards in 2D space is the right of the sprite } move.impulsionDirection(axis); }
private void Awake() { _fireScripts = GetComponentsInChildren <FireScript>(); _moveScript = GetComponent <MoveScript>(); _colliderComponent = GetComponent <Collider2D>(); _rendererComponent = GetComponent <SpriteRenderer>(); }
private void Start() { rb = GetComponent <Rigidbody>(); moveScript = GetComponent <MoveScript>(); // Set points to add depending from enemy scale if (System.Math.Abs(moveScript.scale) > Mathf.Epsilon) { pointsToAdd = (int)(pointsToAdd / moveScript.scale); } else { pointsToAdd = 100; } GameObject gameControllerObject = GameObject.FindWithTag("GameController"); if (gameControllerObject != null) { gameController = gameControllerObject.GetComponent <GameController>(); } else { Debug.LogError("No GameController script could be found in scene."); } }
void Start() { pathfinderobj = GameObject.Find("PathfinderObject"); src = GetComponent <AudioSource>(); Spawner = GameObject.Find("GameManager"); movescript = GetComponent <MoveScript>(); }
public void AttackBullet(bool isEnemy) { // Create a new shot Transform shotTransform = Instantiate(shotPrefab) as Transform; // Assign position shotTransform.position = transform.position; // The is enemy property ShotScript shot = shotTransform.gameObject.GetComponent <ShotScript>(); if (shot != null) { shot.isEnemyShot = isEnemy; } // Make the weapon shot always towards it MoveScript move = shotTransform.gameObject.GetComponent <MoveScript>(); if (move != null) { if (shot.isEnemyShot) { move.direction = -this.transform.right; // towards in 2D space is the right of the sprite } else { move.direction = this.transform.right; EnergyScript energy = GetComponentInParent <EnergyScript>(); energy.Decrement(1); } } }
// Start is called before the first frame update void Start() { ms = GetComponent <MoveScript>(); hs = GetComponent <HealthScript>(); myTransform = GetComponent <Transform>(); spawnTimer = spawnInterval; }
public void Attack(bool isEnemy) { if (CanAttack) { shootCooldown = shootingRate; var shotTransform = Instantiate(shotPrefab) as Transform; shotTransform.position = transform.position; ShotScript shot = shotTransform.gameObject.GetComponent <ShotScript>(); if (shot != null) { shot.isEnemyShot = isEnemy; } MoveScript move = shotTransform.gameObject.GetComponent <MoveScript>(); if (move != null) { if (toTheRight) { move.direction = this.transform.right; } else { move.direction = -this.transform.right; } } } }
void Awake() { weapons = GetComponentsInChildren<WeaponScript>(); moveScript = GetComponent<MoveScript>(); }
void Awake() { // Récupération de toutes les armes de l'ennemi weapons = GetComponentsInChildren<WeaponScript>(); // Récupération du script de mouvement lié moveScript = GetComponent<MoveScript>(); }
// Use this for initialization void Start () { _axeRes = Resources.Load("Battle_axe") as GameObject; Debug.Log(_axeRes); _mover = GetComponent<MoveScript>(); _anim = GetComponent<Animator>(); _health = GetComponent<HealthScript>(); _anim.SetFloat("SpeedX", 0); _anim.SetFloat("SpeedY", -1); }
// Use this for initialization void Start() { target = new Vector3(0,0,0); Corners[0] = new Vector3(-38.5f, 1.64f, -23.5f); Corners[1] = new Vector3(-38.5f, 1.64f, 23.5f); Corners[2] = new Vector3(23.1f, 1.64f, 28.1f); Corners[3] = new Vector3(22f, 1.64f, -27.6f); pacmanMove = pacman.GetComponent<MoveScript>(); Debug.Log(Vector3.Distance(pacmanPos,Corners[0])); }
// Use this for initialization public override void Start() { base.Start(); state = ArcherState.attacking; characterType = CharacterConstants.CharacterType.enemy; //set our gnoll's abilities abilityOne = new MoveScript(this); abilityTwo = new RockThrowScript(this); }
// Use this for initialization public override void Start() { base.Start(); state = TankState.attacking; characterType = CharacterConstants.CharacterType.enemy; //set our tank's abilities abilityOne = new MoveScript(this); abilityTwo = new BasicAttackScript(this); abilityThree = new PushScript(this); }
private MoveScript characterMoveScript; // Move script so we can push the character #endregion Fields #region Methods protected override void UseAbility(GameObject character) { if(characterMoveScript == null) { // Only get target movescript once characterMoveScript = character.GetComponent<MoveScript>(); // Push() is part of MoveScript } Vector2 direction = characterMoveScript.facing; characterMoveScript.Push(direction, amount); }
private MoveScript targetMoveScript; // The target's movement script #endregion Fields #region Methods protected override void ApplyEffect() { if(target) { // Apply the snare to the target targetMoveScript = target.GetComponent<MoveScript>(); // Movespeed is set on MoveScript targetMoveScript.speed *= amount; // Reduce the target's movement script by a percentage } else { // Target is dead, get rid of effect base.EndEffect(); } }
void Awake() { // Retrieve the weapon only once weapons = GetComponentsInChildren<WeaponScript>(); // Retrieve scripts to disable when not spawn moveScript = GetComponent<MoveScript>(); // Get the animator animator = GetComponent<Animator>(); // Get the renderers in children renderers = GetComponentsInChildren<SpriteRenderer>(); }
// Use this for initialization public override void Start() { base.Start(); //set the character type characterType = CharacterConstants.CharacterType.player; //set our fighter's abilities abilityOne = new MoveScript(this); abilityTwo = new BasicAttackScript(this); //abilityThree = new ComboScript(this); //abilityFour = new CircleAttack(this); //abilityFive = new StompScript(this); }
// Use this for initialization void Start () { //Set ref script raycastscript = gameObject.GetComponent("RayCastScript") as RayCastScript; rotateScript = gameObject.GetComponent("RotateScript") as RotateScript; scaleScript = gameObject.GetComponent("ScaleScript") as ScaleScript; stackScript = gameObject.GetComponent("StackScript") as StackScript; moveScript = gameObject.GetComponent("MoveScript") as MoveScript; //Turn off mouse pointer and set the cursorImage screenpointer = (GUITexture)Instantiate(baseGuiTexture); Screen.showCursor = false; screenpointer.texture = cursorImage; screenpointer.color = Color.red; screenpointer.pixelInset = new Rect(10,10,10,10); screenpointer.transform.localScale -= new Vector3(1, 1, 0); }
void Start() { // Get trigger so we can disable it after it happens trigger = GetComponent<BoxCollider2D>(); // Grab player info player = GameObject.FindGameObjectWithTag("Player"); playerScript = player.GetComponent<PlayerScript>(); // Grab camera info mainCamera = GameObject.FindGameObjectWithTag("MainCamera"); cameraScript = mainCamera.GetComponent<CameraScript>(); // Grab boss info boss = GameObject.Find ("Enemies_Dabossman"); bossCollider = boss.GetComponent<BoxCollider2D>(); bossMoveScript = boss.GetComponent<MoveScript>(); // Get rockslide info rockSlideScript = GetComponent<RockSlideScript>(); }
public void Start() { moveScript = GetComponent<MoveScript>(); weaponScript = GetComponentInChildren<WeaponScript>(); spriteRenderer = GetComponent<SpriteRenderer>(); dying = false; cel = 1; celPeriod = 1 / animSpeed; celTime = 0; cycleCount = 0; if (leftBound > rightBound) { Debug.LogError("left bound greater than right bound!"); } GameManager.Instance.AdjustLives(lives); startPos = transform.position; startSpeed = moveScript.speed; }
// Use this for initialization void Start() { //Init controllers wiimote_start(); //Turn off mouse pointer and set the cursorImage screenpointer = (GUITexture)Instantiate(baseGuiTexture); Cursor.visible = false; screenpointer.texture = cursorImage; screenpointer.color = Color.red; screenpointer.pixelInset = new Rect(10,10,10,10); screenpointer.transform.localScale -= new Vector3(1,1,0); //Set ref scripts raycastscript = gameObject.GetComponent("RayCastScript") as RayCastScript; rotateScript = gameObject.GetComponent("RotateScript") as RotateScript; scaleScript = gameObject.GetComponent("ScaleScript") as ScaleScript; stackScript = gameObject.GetComponent("StackScript") as StackScript; moveScript = gameObject.GetComponent("MoveScript") as MoveScript; smoothCameraScript = gameObject.GetComponent("SmoothCameraScript") as SmoothCameraScript; verwijderScript = gameObject.GetComponent("VerwijderScript") as VerwijderScript; selectieScript = gameObject.GetComponent("SelectieScript") as SelectieScript; //Set initial values selectieScript.setSelectionmodeOn(); selectieScript.playerCam = playerCam; modus = Modi.NAV_SEL; }
// Use this for initialization void Start () { player = GetComponent<PlayerController>(); move = GetComponent<MoveScript>(); }
// Use this for initialization void Start() { MVS = GetComponent<MoveScript>(); }
// Use this for initialization void Start() { PacmanMove = Pacman.GetComponent<MoveScript>(); }
void Awake () { moveScript = GetComponentInParent<MoveScript> (); spriteRenderer = GetComponent<SpriteRenderer> (); }
/* ChargeCommandScript - Constructor called when Command is first created _character - the Character that the Command Stack is attached to */ public ChargeCommandScript(GameObject _character) : base(_character) { moveScript = character.GetComponent<MoveScript>(); }
void Awake() { // Retrieve the weapon only once weapons = GetComponentsInChildren<WeaponScript>(); moveScript = (MoveScript) GetComponent(typeof(MoveScript)); }
// Use this for initialization void Start () { move = this.GetComponent<MoveScript>(); }
// Use this for initialization void Start() { player = GameManager.playerScript.gameObject; piTrapScript = player.GetComponent<PlayerIsTrapScript>(); playerAnim = player.GetComponent<Animator>(); playerScript = player.GetComponent<PlayerScript>(); moveScript = player.GetComponent<MoveScript>(); deltaScale = sightScaleInit - sightScale; deltaScale = deltaScale / scaleTime; transform.localScale = sightScaleInit; initCol = GetComponent<SpriteRenderer>().color; alphaAttenuation = initCol.a / sightDelTime; initRot = transform.rotation; effects = new SightLineScript[7]; for (int n = 0; n < effects.Length; n++) { effects[n] = ((GameObject)Instantiate(effect, Vector3.zero, playerScript.transform.rotation)).GetComponent<SightLineScript>(); effects[n].render.enabled = false; } }
void Awake() { moveScript = GetComponent<MoveScript>(); characterScript = GetComponent<CharacterScript>(); animator = GetComponent<Animator>(); }
public void aiAct() { //Perform decision making based off of decision parameters decided by overarching AI. System.Random random = new System.Random(); //Check if idle behavior instead of non-idle. if(random.NextDouble() < moveIdle) { moveDirB = MoveDirBehavior.IDLE; } else { //Check if offensive movement behavior instead of defensive. if(random.NextDouble() < moveDir) moveDirB = MoveDirBehavior.TOWARD; else moveDirB = MoveDirBehavior.AWAY; } //Check if global movement behavior instead of non-global. if(random.NextDouble() > moveGlobalScope) { moveScopeB = MoveScopeBehavior.GLOBAL; } else { //Check if macro movement behavior instead of micro. if(random.NextDouble() > moveScope) moveScopeB = MoveScopeBehavior.MACRO; else moveScopeB = MoveScopeBehavior.MICRO; } //Check if head target behavior instead of body. if(random.NextDouble() > moveTarget) moveTargetB = MoveTargetBehavior.HEAD; else moveTargetB = MoveTargetBehavior.BODY; //Check if ally target behavior instead of enemy. if(random.NextDouble() > moveTeam) moveTeamB = MoveTeamBehavior.ALLY; else moveTeamB = MoveTeamBehavior.ENEMY; //Check if macro behavior instead of micro. if(random.NextDouble() > attack) attackB = AttackBehavior.MACRO; else attackB = AttackBehavior.MICRO; //Possible blocks to attack. LinkedList<GridBlock> attackBlocks = getAttackBlocks(); //Choose the block to attack from attack block list. GridBlock attackBlock = chooseAttackBlock(attackBlocks); //Check if there's nowhere to attack or enemy is stronger, then move or attack. if(attackBlocks.Count == 0 || attackBlock.unitInstalled.getHealthPercentage() > unit.getHealthPercentage()) { //Get the list of blocks to move to. LinkedList<GridBlock> moveBlockList = getMoveBlockList(); foreach(GridBlock b in moveBlockList) { MoveScript ms = new MoveScript(unit, b); } } else { AttackScript ms = new AttackScript(unit, attackBlock); } }
void Start() { moveScript = GetComponent<MoveScript>(); soundTime = soundPeriod; }
void Awake () { moveScript = GetComponent<MoveScript> (); }