void Start() { GameObject gamePlayer = GameObject.FindWithTag("Player"); pState = gamePlayer.GetComponent<PlayerBehavior>(); }
// Use this for initialization void Start () { this.main_camera = GameObject.Find("Main Camera"); // mobile this.left_button = GameObject.Find("Left Button").GetComponent<UIButtonInput>(); this.right_button = GameObject.Find("Right Button").GetComponent<UIButtonInput>(); this.jump_button = GameObject.Find("Jump Button").GetComponent<UIButtonInput>(); this.action_button = GameObject.Find("Action Button").GetComponent<UIButtonInput>(); // end mobile // pc /*this.left_button = new UIButtonInput(); this.right_button = new UIButtonInput(); this.jump_button = new UIButtonInput(); this.action_button = new UIButtonInput();*/ // end pc this.player = PlayerBehavior.CreatePlayerBehavior(); this.carrying_carrot = null; this.carrots = new List<CarrotBehavior>(); this.stems = new List<StemBehavior>(); this.AddStem(); this.AddStem(); }
protected static PlayerBehavior InitializePlayerBehavior(PlayerBehavior behavior) { InitializeRigidbodyBehavior(behavior, SpriteBehavior.ColliderType.Polygon, "player"); behavior.rigid_body.freezeRotation = true; behavior.ResetPosition(); behavior.gameObject.transform.localScale = new Vector3(scale, scale); return behavior; }
protected override void onInteract(PlayerBehavior interactee) { base.onInteract (interactee); if(!spawningItem){ releaseItem(); } this.doneInteracting(interactee); }
// Use this for initialization void Start () { rightArm = GameObject.FindWithTag("HookController"); pb = GameObject.FindWithTag("Player").GetComponent<PlayerBehavior>(); HookCollider = GameObject.FindWithTag("HookCollider"); hs = HookCollider.GetComponent<HookSelect>(); this.Disable(); this.Hide(); }
void Awake() { // Set up references playerBehavior = GetComponent<PlayerBehavior>(); playerMovement = GetComponent<PlayerMovement>(); realtimeCamera = References.realtimeCamera.GetComponent<PlayerCameraRotation>(); events = EventSystem.current; }
public void doneInteracting(PlayerBehavior interactee) { if(active){ interactee.setInteracting(false); currentPlayersControlling --; onDoneInteracting(); } }
void Awake() { if (player == null) { player = this; DontDestroyOnLoad(gameObject); } else if (player != this) Destroy(gameObject); }
// // Destroy previously spawned player and respawn // public void Reset() { if (player != null) { Destroy(player.gameObject); player = null; } SpawnPlayer(); }
public void SetData(PlayerBehavior bc) { player = bc; SpriteRenderer img = (SpriteRenderer)transform.Find("Card Picture").GetComponent("SpriteRenderer"); img.sprite = properties.card_image; TextMesh txt = (TextMesh)transform.Find ("Card Text").GetComponent("TextMesh"); txt.text = properties.card_description; txt = (TextMesh)transform.Find ("Card Name").GetComponent("TextMesh"); txt.text = properties.card_name; }
void Awake() { // Set up references playerBehavior = GetComponent<PlayerBehavior>(); playerStats = GetComponent<PlayerStats>(); playerAttacks = GetComponent<PlayerAttacks>(); navigation = GetComponent<NavMeshAgent>(); References.stateManager.changeState += onStateChange; }
// Use this for initialization protected void Start() { //protected - accessible from derived classes r = GetComponentInChildren<ReachPointBehavior>(); p = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerBehavior>(); if(!hasReachPoint) { areaRect = new Rect(transform.position.x - transform.localScale.x * 0.5f, transform.position.z - transform.localScale.z * 0.5f, transform.localScale.x, transform.localScale.z); playerCoords = new Vector2(p.transform.position.x, p.transform.position.z); } }
public void use(PlayerBehavior interactee) { if(currentPlayersControlling < maxPlayersControlling){ interactee.setInteracting(true); currentPlayersControlling++; onStartInteract(); } else{ onInteract(interactee); } }
// Use this for initialization void Start() { if (portadorVida.tag == "Player") { this.player = portadorVida.GetComponent("PlayerBehavior") as PlayerBehavior; this.status = this.player.getStatus(); } else if (portadorVida.tag == "inimigo") { this.inimigo = portadorVida.GetComponent("EnemyBehavior") as EnemyBehavior; this.status = this.inimigo.getStatus(); } this.HPTotal = this.status.hp; }
// first function called when space is initialized void Awake() { if (!(player)) { player=GameObject.Find("Player").GetComponent<PlayerBehavior>(); } // cacheing references to child objects for later use in the mouse effects myParticles=transform.Find("DrippingStarsParticles").GetComponent<ParticleEmitter>(); myLight=transform.Find("Spotlight").GetComponent<Light>(); // setting the renderqueue of the particles above transparent always puts the particles on top transform.Find("DrippingStarsParticles").GetComponent<ParticleRenderer>().renderer.material.renderQueue=4000; }
// Use this for initialization void Start () { int h = Screen.height; healthtxtPos = new Rect(30, 150, 100, 30); healthFrontPos = new Rect(80,150,100,30); healthBackPos = new Rect(80,150,100,30); GameObject gamePlayer = GameObject.FindWithTag("Player"); if(gamePlayer != null) pState = gamePlayer.GetComponent<PlayerBehavior>(); else pState = null; }
/// <summary>Builds the message the sender sees on the screen, and deals with AFK stuff.</summary> /// <param name="fixedSentence">The base fixed sentence.</param> /// <returns>The final string the sender of the tell will see.</returns> private string BuildOriginatorMessage(string fixedSentence) { PlayerBehavior playerBehavior = this.target.Behaviors.FindFirst <PlayerBehavior>(); if (playerBehavior != null && playerBehavior.IsAFK) { string afkMessage; if (!string.IsNullOrEmpty(playerBehavior.AFKReason)) { afkMessage = string.Concat("AFK: ", playerBehavior.AFKReason); } else { afkMessage = "AFK"; } return(string.Format("You tell {0}: {1}<%nl%>{0} is {2}.", this.target.Name, fixedSentence, afkMessage)); } else { return(string.Format("You tell {0}: {1}", this.target.Name, fixedSentence)); } }
/// <inheritdoc /> public bool Act(PlayerBehavior actor) { if (CurrentClip == 0) { return(false); } CurrentClip -= 1; for (var i = 0; i < _shared.NumberOfPellets; i++) { var positionAndRotation = _shared.MuzzleOffset.ToLocation(transform); var projectileInstance = _shared.ProjectileDescriptor.ProjectileTemplate.CreateInstance(positionAndRotation); var randomAngle = Random.Range(-15, (float)15) * _shared.Spread; projectileInstance.transform.rotation *= Quaternion.Euler(0, 0, randomAngle); var behavior = projectileInstance.GetComponent <ProjectileBehavior>(); behavior.Initialize(_shared, _shared.ProjectileDescriptor, actor); } return(true); }
void Start() { playerBehavior = GetComponent <PlayerBehavior>(); interactable = GetComponent <Interactable>(); isMoving = false; }
public Land(PlayerBehavior player) { _Player = player; _TimeInSquad = 0.3f; }
void Start() { // Get references playerBehavior = GetComponent <PlayerBehavior> (); cam = Camera.main; }
public Slide(PlayerBehavior player) { _Player = player; }
public Jump(PlayerBehavior player, float jumpforce) { _Player = player; _JumpForce = jumpforce; }
// Use this for initialization void Start() { player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerBehavior>(); }
public Idle(PlayerBehavior player) { _Player = player; }
// Use this for initialization void Start() { if (portador.tag == "Player") { this.player = portador.GetComponent("PlayerBehavior") as PlayerBehavior; this.defesaAtual = this.status.defesa+this.player.getStatus().defesa; } else if (portador.tag == "inimigo") { this.inimigo = portador.GetComponent("EnemyBehavior") as EnemyBehavior; this.defesaAtual = this.status.defesa + this.inimigo.getStatus().defesa; } this.defesaBase = this.defesaAtual; this.buffPortador(); }
void Awake() { behavior = duck.GetComponent<PlayerBehavior>(); }
// Use this for initialization void Awake() { if (!(player)) { player=GameObject.Find("Player").GetComponent<PlayerBehavior>(); } if (!(shelf)) { shelf= GameObject.Find("Shelf").GetComponent<ShelfBehavior>(); } }
// Use this for initialization void Start() { p = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerBehavior>(); mCam = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<Camera>(); rayHits = false; }
// Use this for initialization void Start() { render = gameObject.GetComponent<SpriteRenderer>(); player = FindObjectOfType(typeof(PlayerBehavior)) as PlayerBehavior; }
void Awake() { // Set up references playerBehavior = GetComponent<PlayerBehavior>(); playerStats = GetComponent<PlayerStats>(); }
protected virtual void onInteract(PlayerBehavior interactee) { if(interactee.pc.use){ doneInteracting(interactee); } }
void Start() { S = this; _thisCamera = transform.GetChild(0); }
//Called when being looked at by player public void OnLookEnter(PlayerBehavior p) { isSelected = true; player = p; }
public override void Use(PlayerBehavior player) { ItemMoreDice moreDice = new ItemMoreDice(); moreDice.Use(player); }
public virtual void activateBonus(PlayerBehavior player) { }
// Use this for initialization void Start() { pMono = player.GetComponent<PlayerBehavior>(); }
public abstract void Use(PlayerBehavior player);
public Walk(PlayerBehavior player) { _Player = player; }
// Use this for initialization void Start() { status = objStatus.GetComponent ("Status") as Status; barraHP = objBarraHP.GetComponent ("HP_Bar") as HP_Bar; player = FindObjectOfType (typeof(PlayerBehavior)) as PlayerBehavior; Arma armaInimigo = objArma.GetComponent ("Arma") as Arma; armaInimigo.setPortador (objStatus); //teste.text = armaInimigo.getDanoBase () + ""; distanciaDoPlayer = Vector3.Distance(transform.position,player.transform.position);//pega a distancia do inimigo para o jogador setEstado (Estado_Do_Inimigo.idle); }
public Squad(PlayerBehavior player) { _Player = player; ShortHopWindow = 0.32f; }
private void OnTriggerExit2D(Collider2D coll) { //detecta o fim da colisão APENAS quando o player não estiver mais no campo de visão PolygonCollider2D[] poli = GetComponentsInChildren<PolygonCollider2D>() as PolygonCollider2D[];//pega o pollygonCollider2D(campo de visaõ) if (coll.gameObject.tag == "Player" && poli[0].IsTouching(coll)==false) {//Se o player não estiver mais no campo de visão, pare de seguir player = null; } }
public Fall(PlayerBehavior player) { _Player = player; }
// Sets the targetedPlayer object to the current player. // Also ensures that the targetedPlayer's game controller is set for spotplayer to work properly. private void setTargetedPlayer(PlayerBehavior newPlayer) { targetedPlayer.SetNewPlayer(newPlayer); }
public State(PlayerBehavior player) { _Player = player; }
/// <summary>Verifies that the proposed command can be performed by the acting entity.</summary> /// <param name="command">The issued command to be carried out.</param> /// <returns>A string defining why the permission was not given, else null if permission is given.</returns> public static string VerifyCommandPermission(ScriptingCommand command) { if (command.SecurityRole == SecurityRole.none) { // If you are debugging here after trying to set up your own action, // you probably forgot to assign an appropriate [ActionSecurity(...)] // attribute for your new GameAction class. return(string.Format("Nobody can use '{0}' right now!", command.Name)); } Thing entity = command.ActionInput.Controller.Thing; if (entity == null) { return("You must exist before issuing commands!"); } PlayerBehavior player = entity.Behaviors.FindFirst <PlayerBehavior>(); if (player != null) { // @@@ TODO: Ascertain the ACTUAL player's specific permissions, so we can // check for fullAdmin, fullBuilder, etc, instead of assuming just // 'SecurityRole.player' SecurityRole playerRoles = SecurityRole.player | SecurityRole.minorBuilder | SecurityRole.fullBuilder | SecurityRole.minorAdmin | SecurityRole.fullAdmin; // If any of the command's security roles and the player's security roles // overlap (such as the command is marked with 'minorBuilder' and the // player has the 'minorBuilder' flag) then we permit the command. if ((command.SecurityRole & playerRoles) != SecurityRole.none) { return(null); } // Otherwise, this player does not have permission; we do not want to // check the mobile/item/room security role on players, so we're done. return(string.Format("You do not have permission to use '{0}' right now.", command.Name)); } MobileBehavior mobile = entity.Behaviors.FindFirst <MobileBehavior>(); if (mobile != null) { if ((command.SecurityRole & SecurityRole.mobile) != SecurityRole.none) { return(null); } return(string.Format("A mobile can not use '{0}' right now!", command.Name)); } RoomBehavior room = entity.Behaviors.FindFirst <RoomBehavior>(); if (room != null) { if ((command.SecurityRole & SecurityRole.room) == SecurityRole.none) { return(null); } return(string.Format("A room can not use '{0}' right now!", command.Name)); } // @@@ For now, everything else which doesn't meet any above category will need the 'item' security // role. (Do we need an ItemBehavior or is there something else relevant... CanPickupBehavior etc?) if ((command.SecurityRole & SecurityRole.item) != SecurityRole.none) { return(null); } return(string.Format("An item (or unrecognized entity) can not use '{0}' right now!", command.Name)); }
// Use this for initialization void Awake() { score = 0; duckBehavior = duck.GetComponent <PlayerBehavior>(); }
// Start is called before the first frame update void Start() { state = PlayerBehavior.walking; gameObject.layer = LayerMask.NameToLayer("Player"); m_Walking = false; }
// Use this for initialization void Awake() { rb = GetComponent <Rigidbody2D>(); pb = GetComponent <PlayerBehavior>(); anim = GetComponent <Animator>(); }
// Use this for initialization void Awake() { player = transform.parent.parent.parent.GetComponent <PlayerBehavior>(); }
public void Start() { player = FindObjectOfType <PlayerBehavior> (); }
private void SlopeLimitEventHandler(object sender, EventArgs args) { // prevent moving up slopes we can't move up PlayerBehavior.SetMoveDirection(new Vector3(PlayerBehavior.MoveDirection.x, 0.0f, 0.0f)); }
private void GetPlayer() { _playerbehavior = GameObject.Find(Player.ToString()).GetComponent <PlayerBehavior>(); _gameManagerBehavior = GameObject.Find("$GameManager").GetComponent <GameManagerBehavior>(); }
private void Awake() { playerBehavior = GameObject.Find("GenerateStack").GetComponent <PlayerBehavior>(); }
public virtual void deactivateMalus(PlayerBehavior opponent) { }
// Use this for initialization void Awake () { score = 0; duckBehavior = duck.GetComponent<PlayerBehavior>(); }
public void applyFor(PlayerBehavior player) { Use(player); }
// Use this for initialization void Start () { lePlayerBehavior = FindObjectOfType<PlayerBehavior>(); leGlitter.SetActive(false); }
// Use this for initialization void Start() { player_s = player.GetComponent <PlayerBehavior>(); }
//Esse método é responsavel pela visão do inimigo //quando o player "colide"(ou seja entra) no campo de visão //do inimigo o inimigo iniciará a perseguição ao player //caso o player saia do seru campo de visão, ele não //o seguirá mais private void OnTriggerEnter2D(Collider2D coll) { if (coll.gameObject.tag == "Player") { player = coll.gameObject.GetComponent("PlayerBehavior") as PlayerBehavior; } }