Inheritance: MonoBehaviour
Exemple #1
0
    void Awake()
    {
        //set standard position to the transforms current position
        initalPos = transform.position;

        //find the PlayerInteraction script and add the floorswitch function to the floor delicate
        playerInterAction = GameObject.FindGameObjectWithTag(Tags.PlayerObject).GetComponent<PlayerInteraction>();
        playerInterAction.Floor += FloorSwitch;
    }
Exemple #2
0
    void Awake()
    {
        //set the inital position on the door to the door's current position
        initalPos = transform.position;

        //Find the players playerinteraction
        playerInterAction = GameObject.FindGameObjectWithTag(Tags.PlayerObject).GetComponent<PlayerInteraction>();

        //Add the doorstart to the playerInterAction door delicate
        playerInterAction.Door += DoorStart;
    }
    private void Start()
    {
        // get the transform of the main camera
            if (Camera.main != null)
            {
                m_Cam = Camera.main.transform;
            }
            else
            {
                Debug.LogWarning(
                    "Warning: no main camera found. Third person character needs a Camera tagged \"MainCamera\", for camera-relative controls.");
                // we use self-relative controls in this case, which probably isn't what the user wants, but hey, we warned them!
            }

            // get the third person character ( this should never be null due to require component )
            m_Character = GetComponent<ThirdPersonCharacter>();
            m_Interaction = GetComponent<PlayerInteraction>();
    }
 public override void InteractStop(PlayerInteraction playerInteraction)
 {
     Debug.Log("Interact stop with " + name, gameObject);
 }
Exemple #5
0
 // Use this for initialization
 void Start()
 {
     playerInteraction = GetComponent <PlayerInteraction> ();
     rgdPlayer         = GetComponent <Rigidbody2D> ();
 }
Exemple #6
0
 public override async Task Call(Card caller, GameHandler gameHandler, ulong curPlayer, ulong enemy, ExtraEffectInfo extraInf)
 {
     List <Upgrade> pool = CardsFilter.FilterList <Upgrade>(gameHandler.players[curPlayer].pool.upgrades, x => x.rarity == Rarity.Legendary);
     await PlayerInteraction.DiscoverACardAsync <Upgrade>(gameHandler, curPlayer, enemy, extraInf.ctx, "Discover a Legendary Upgrade", pool);
 }
Exemple #7
0
 protected virtual void Awake()
 {
     playerMovement    = GetComponent <PlayerMovement>();
     playerAnimation   = GetComponent <PlayerAnimation>();
     playerInteraction = GetComponent <PlayerInteraction>();
 }
 public override void InteractHold(PlayerInteraction playerInteraction)
 {
     isResuscitating = true;
     return;
 }
Exemple #9
0
 void Awake()
 {
     playerInteraction = GetComponent <PlayerInteraction>();
 }
 void Start()
 {
     m_Animator = GetComponent<Animator>();
         m_Rigidbody = GetComponent<Rigidbody>();
         m_Interaction = GetComponent<PlayerInteraction>();
         m_Rigidbody.constraints = RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationY | RigidbodyConstraints.FreezeRotationZ;
 }
Exemple #11
0
 public override void InteractionStart(PlayerInteraction player)
 {
     ResetTimer();
     _player        = player;
     _actionOnGoing = true;
 }
Exemple #12
0
 public override void InteractionInterrupt(PlayerInteraction player)
 {
     _actionOnGoing = false;
     _timer.Stop();
 }
Exemple #13
0
 public void Hit(PlayerInteraction player)
 {
 }
 private void Awake()
 {
     inst  = this;
     _anim = GetComponentInChildren <Animator>();
 }
 // Awake is always called before any Start function and after every object has been initialized.
 private void Awake()
 {
     Instance = this; //Se guarda la instancia de esto
 }
Exemple #16
0
 private void Start()
 {
     playerInteraction = GetComponent <PlayerInteraction>();
 }
Exemple #17
0
 /* Sets canSprite and transforms position to player position */
 private void ShowCan(PlayerInteraction p)
 {
     spriteRenderer.sprite = canSprite;
     transform.position    = p.gameObject.transform.position;
 }
        /// <summary>
        /// return true to block packet
        /// </summary>
        bool UseEntityFromClient(UseEntity ue)
        {
            //Attack others
            if (ue.Type == UseEntity.Types.Attack)
            {
                //Admin instant kill using bedrock
                if (Player.Admin() &&
                    this.ActiveItem != null &&
                    this.ActiveItem.ItemID == BlockID.Bedrock)
                {
                    VanillaSession dust = World.Main.GetPlayer(ue.Target);
                    if (dust == null)
                    {
                        Player.TellSystem(Chat.Purple, "Failed to find player");
                        return(true);
                    }
                    dust.SendToBackend(new ChatMessageClient("/kill"));
                    Log.WritePlayer(this, "Admin kill: " + dust.Player.MinecraftUsername);
                    return(true);
                }

                if (Player.Settings.Cloaked != null)
                {
                    return(false);
                }

                Debug.WriteLine("Attacked: " + ue.Target);
                VanillaSession target = World.Main.GetPlayer(ue.Target);

                if (target == null && Player.Settings.Cloaked == null)
                {
                    Entity      e  = World.Main.GetEntity(ue.Target);
                    var         m  = e as Mob;
                    var         v  = e as Vehicle;
                    WorldRegion cr = CurrentRegion;
                    //prevent killing mobs and villagers inside region
                    if (cr != null && cr.Type == "protected" && (cr.IsResident(Player) == false))
                    {
                        if (m != null && m.Type >= MobType.Pig)
                        {
                            Player.TellSystem(Chat.Pink, "No killing inside this region");
                            return(true);
                        }
                        if (v != null && v.Type == Vehicles.Frame)
                        {
                            //Protect frames
                            Debug.WriteLine("Frame protected");
                            return(true);
                        }
                    }
                    if (m != null && m.Owner != "")
                    {
                        //this could prevent killing of tamed animals
                    }
                }
                if (target != null && target.Player.Settings.Cloaked == null)
                {
                    if (this.ActiveItem != null)
                    {
                        switch (this.ActiveItem.ItemID)
                        {
                        case BlockID.Rose:
                        case BlockID.Dandelion:
                            PlayerInteraction.Prod(this.Player, target.Player);
                            return(true);
                        }
                    }

                    //Anywhere but war
                    WorldRegion r = CurrentRegion;
                    if (r != null && r.Type == "war")
                    {
                        //War Zone
                        //r.Say (Chat.Yellow + Name + Chat.Gold + " attacked " + Chat.Yellow + target.Name + Chat.Gold + " using " + newAttack.Item);
                        SendToBackend(ue);
                        return(true);
                    }

                    //Anywhere but war
                    if (Player.PvP == false)
                    {
                        Player.TellSystem(Chat.Purple, "PvP active");
                        Player.PvP = true;
                    }

                    Attacked newAttack = new Attacked(this.Player);

                    if (target.Attacker == null || target.Attacker.Timestamp.AddSeconds(10) < DateTime.Now)
                    {
                        //Regular zone
                        if (target.Player.PvP == false && ((r == null) || (r.IsResident(Player) == false)))
                        {
                            if (target.lastPvpMessage < DateTime.Now)
                            {
                                target.lastPvpMessage = DateTime.Now.AddSeconds(5);
                                PlayerInteraction.Prod(target.Player);
                                target.Player.TellSystem(Chat.Pink, Player.Name + " can't hurt you");
                            }
                            Player.TellSystem(Chat.Pink, "You challenge " + target.Player.Name + " to a fight to the " + Chat.Red + "death");
                            return(true);
                        }

                        string msg = Player.Name + " attacked " + target.Player.Name + " using " + newAttack.Item;
                        Chatting.Parser.SayFirehose(Chat.Gray, msg);
                        target.TellSystem(Chat.Gray, msg);
                        this.TellSystem(Chat.Gray, msg);
                        Log.WriteAction(target.Player, newAttack, false);
                    }
                    target.Attacker = newAttack;
                }
                return(false);
            }
            else
            {
                //Right click
                Mob m = World.Main.GetEntity(ue.Target) as Mob;
                if (m == null)
                {
                    return(false);
                }
                if (m.Owner == "")
                {
                    return(false);
                }

                if (m.Type == MobType.Ocelot)
                {
                    this.TellSystem(Chat.Pink, "Meow " + m.Owner);
                }
                else if (m.Type == MobType.Wolf)
                {
                    this.TellSystem(Chat.Pink, "Woof " + m.Owner);
                }
                else
                {
                    this.TellSystem(Chat.Pink, "Owner: " + m.Owner);
                }

                return(false);
            }
        }
Exemple #19
0
 public override void InteractStop(PlayerInteraction playerInteraction)
 {
     Debug.LogError("Deprecated item");
     throw new System.NotImplementedException();
 }
Exemple #20
0
 void Start()
 {
     //getting the players script and adding the nextlevel function
     playerInterAction = GameObject.FindGameObjectWithTag(Tags.PlayerObject).GetComponent<PlayerInteraction>();
     playerInterAction.NextLevel += NextLevel;
 }
Exemple #21
0
 public void Interact(PlayerInteraction player)
 {
     Activate();
 }
 private void Start()
 {
     gameManager1      = FindObjectOfType <GameManager1>();
     playerInteraction = FindObjectOfType <PlayerInteraction>();
 }
Exemple #23
0
 public override bool Interact(HoldableObject carryingObject, PlayerInteraction playerInteraction)
 {
     TeleportPlayerToCounterpart(playerInteraction);
     return(true);
 }
 public override async Task Battlecry(GameHandler gameHandler, int curPlayer, int enemy)
 {
     List <Upgrade> pool = CardsFilter.FilterList <Upgrade>(gameHandler.players[curPlayer].pool.upgrades, x => x.rarity == Rarity.Legendary);
     await PlayerInteraction.DiscoverACardAsync <Upgrade>(gameHandler, curPlayer, enemy, "Discover a Legendary Upgrade", pool);
 }
 public override void InteractStop(PlayerInteraction playerInteraction)
 {
     throw new System.NotImplementedException();
 }
 private void TakeUpProduct(PlayerInteraction p)
 {
     p.SetProduct(activeRecipe.outputProduct);
     Reset();
 }
    void Awake()
    {
        instance = this;
        ResetEvents();

        anim = GetComponent<Animator>();
        audio = GetComponent<PlayerAudio>();
        damageFlash = GetComponent<SpriteFlash>();
        feedback = GetComponent<PlayerForceFeedback>();
        health = GetComponent<PlayerHealth>();
        input = GetComponent<PlayerInput>();
        interaction = GetComponent<PlayerInteraction>();
        physics = GetComponent<PlayerPhysics>();
        weapon = GetComponent<PlayerWeapon>();

        meleeAttackBox = transform.FindChild("MeleeAttackBox").gameObject;
    }
 public override void InteractStop(PlayerInteraction playerInteraction)
 {
     isResuscitating      = false;
     fillImage.fillAmount = 0;
     return;
 }
 public override void Interact(PlayerInteraction playerInteraction)
 {
     //base.Interact(playerInteraction);
 }
 // Use this for initialization
 // ReSharper disable once UnusedMember.Local
 void Start()
 {
     _player = GameObject.FindGameObjectWithTag("Player");
     _playerMovementScript = _player.GetComponent<PlayerInteraction>();
 }
Exemple #31
0
 public void SetPlayerTransform(Transform playerXform)
 {
     playerTransform = playerXform;
     interactionScript = playerTransform.GetComponent<PlayerInteraction>();
     tpController = (playerTransform.GetComponent("CustomThirdPersonController") as MonoBehaviour);
     GetComponent<CameraPhysics>().SetCameraController(playerTransform.GetComponent("CustomThirdPersonCamera") as MonoBehaviour);
 }
Exemple #32
0
 void Start()
 {
     interaction = GetComponent <PlayerInteraction> ();
 }
 void Awake()
 {
     anim = GetComponent <Animator> ();
     playerAudio = GetComponent <AudioSource> ();
     playerMovement = GetComponent <ThirdPersonCharacter> ();
     //playerShooting = GetComponentInChildren <PlayerShooting> ();
     currentHealth = startingHealth;
     HealthSliderStatus(currentHealth);
     //healthSlider.value = currentHealth;
     playerInterction = GetComponent <PlayerInteraction> ();
 }
 private void Awake()
 {
     _anim = gameObject.GetComponent <Animator>();
     _playerInteraction = gameObject.GetComponent <PlayerInteraction>();
 }
 void Start()
 {
     pi = GetComponentInParent <PlayerInteraction> ();
 }
Exemple #36
0
 void Awake()
 {
     SharedInstance = this;
     coinScript     = coinGenerator.GetComponent <ObjectGenerator>();
 }
Exemple #37
0
    public void RpcComparePlayersElementTypes(GameObject other)
    {
        PlayerInteraction interaction = other.GetComponent <PlayerInteraction>();

        switch (elementType)
        {
        ////check other player against current element
        //case ElementEnum.Elements.Ash:
        //    //Destroy self if lose
        //    switch (interaction.elementType)
        //    {
        //        //cheese always wins
        //        case ElementEnum.Elements.Cheese:
        //            Debug.Log(this + " Loses to cheese");
        //            callRespawn();
        //            gameObject.SetActive(false);
        //            break;
        //            //Grass beats ash
        //        case ElementEnum.Elements.Grass:
        //            Debug.Log(this + " Loses to Grass");
        //            callRespawn();
        //            gameObject.SetActive(false);
        //            break;
        //    }
        //    break;
        //cheese always win
        case ElementEnum.Elements.Cheese:
            Debug.Log("Cheese always wins");
            DyingSound(other);
            break;

        case ElementEnum.Elements.Fire:
            switch (interaction.elementType)
            {
            //cheese always wins
            case ElementEnum.Elements.Cheese:
                //  Debug.Log(this + " Loses to Cheese");
                anim.SetBool("Dead", true);
                callRespawn();
                gameObject.SetActive(false);
                DyingSound(other);
                break;

            //water beats fire
            case ElementEnum.Elements.Water:
                //   Debug.Log(this + " Loses to Water");
                anim.SetBool("Dead", true);
                callRespawn();
                gameObject.SetActive(false);
                DyingSound(other);
                break;
            }
            break;

        case ElementEnum.Elements.Water:
            switch (interaction.elementType)
            {
            //ahs beats water
            case ElementEnum.Elements.Grass:
                Debug.Log(this + " Loses to Ash");
                anim.SetBool("Dead", true);
                callRespawn();
                gameObject.SetActive(false);
                DyingSound(other);
                break;

            case ElementEnum.Elements.Cheese:
                // Debug.Log(this + " Loses to Cheese");
                callRespawn();
                anim.SetBool("Dead", true);
                gameObject.SetActive(false);
                DyingSound(other);
                break;
            }
            break;

        case ElementEnum.Elements.Grass:
            switch (interaction.elementType)
            {
            case ElementEnum.Elements.Cheese:
                // Debug.Log(this + " Loses to Cheese");
                callRespawn();
                anim.SetBool("Dead", true);
                gameObject.SetActive(false);
                DyingSound(other);
                break;

            //fire beats grass
            case ElementEnum.Elements.Fire:
                // Debug.Log(this + " Loses to Fire");
                callRespawn();
                anim.SetBool("Dead", true);
                gameObject.SetActive(false);
                DyingSound(other);
                break;
            }
            break;
        }
    }
Exemple #38
0
 void Start()
 {
     //gets the playerInteraction script and adds the trapdoor function to the delecate
     playerInteraction = GameObject.FindGameObjectWithTag(Tags.PlayerObject).GetComponent<PlayerInteraction>();
     playerInteraction.TrapDoor += TrapDoor;
 }
Exemple #39
0
 public override async Task Call(Card caller, GameHandler gameHandler, ulong curPlayer, ulong enemy, ExtraEffectInfo extraInf)
 {
     await PlayerInteraction.DiscoverACardAsync <Upgrade>(gameHandler, curPlayer, enemy, extraInf.ctx, "Discover a 1-Cost Upgrade",
                                                          CardsFilter.FilterList <Upgrade>(gameHandler.players[curPlayer].pool.upgrades, x => x.Cost == 1));
 }
 // Use this for initialization
 void Start()
 {
     pi = GetComponent<PlayerInteraction>();
 }
Exemple #41
0
                    public override async Task Call(Card caller, GameHandler gameHandler, ulong curPlayer, ulong enemy, ExtraEffectInfo extraInf)
                    {
                        await PlayerInteraction.FreezeUpgradeInShopAsync(gameHandler, curPlayer, enemy, extraInf.ctx);

                        gameHandler.players[curPlayer].hand.AddCard(new AbsoluteZero());
                    }