Inheritance: MonoBehaviour
Example #1
0
    public static Vector2 GetPlayerBorder(float playerLenth)
    {
        float upBoardEdgePosition   = PlayerProperties.CalculateBoardEdgePostion(upBorder, true);
        float downBoardEdgePosition = PlayerProperties.CalculateBoardEdgePostion(downBorder, false);

        return(new Vector2(upBoardEdgePosition - playerLenth / 2, downBoardEdgePosition + playerLenth / 2));
    }
Example #2
0
        private void LoadPlayersProperties()
        {
            BinaryFormatter formatter = new BinaryFormatter();

            try
            {
                FileStream stream = new FileStream(FILENAME, FileMode.Open);

                PlayerProperties player1Properties = (PlayerProperties)formatter.Deserialize(stream);
                this.ctrlPlayer1.Type       = player1Properties.Type;
                this.ctrlPlayer1.PlayerName = player1Properties.Name;
                this.ctrlPlayer1.MaxDepth   = player1Properties.MaxDepth;

                PlayerProperties player2Properties = (PlayerProperties)formatter.Deserialize(stream);
                this.ctrlPlayer2.Type       = player2Properties.Type;
                this.ctrlPlayer2.PlayerName = player2Properties.Name;
                this.ctrlPlayer2.MaxDepth   = player2Properties.MaxDepth;

                stream.Close();
            }
            catch (FileNotFoundException)
            { }
            catch (SerializationException)
            { }
        }
Example #3
0
    // Use this for initialization
    public virtual void Start()
    {
        if (isPickup)
        {
            return;
        }
        Transform tempObject = FindParent.FindParentTransformWithTag("Player", transform);

        while (FindParent.FindParentTransformWithTag("Player", tempObject) != null)
        {
            tempObject = FindParent.FindParentTransformWithTag("Player", tempObject);
        }
        Debug.Log(FindParent.callAmount);
        player           = tempObject.gameObject;
        playerProperties = player.GetComponent <PlayerProperties>();
        reticleUIElement = player.transform.Find("SinglePlayer UI/Reticle").gameObject;

        if (anim == null)
        {
            anim = GetComponent <Animator>();
        }
        aud        = GetComponent <AudioSource>();
        updateAmmo = player.transform.Find("SinglePlayer UI/HUD/Ammo Count").GetComponent <UpdateAmmo>();

        if (reticleGameObject && reticleGameObject.GetComponent <SpriteRenderer>())
        {
            Debug.Log("There is a reticle gameObject attached to this weapon");

            reticle = reticleGameObject.GetComponent <SpriteRenderer>().sprite;
        }
    }
Example #4
0
 public void LoadMainMenu()
 {
     SceneManager.LoadScene(0);
     _playerProperties = null;
     uiHandler.SetPlayerHudVisibility(false);
     uiHandler.SetMainMenuVisibility(true);
 }
Example #5
0
    public bool CanPlayerAttack(PlayerProperties targetPlayer)
    {
        bool areBothOnFrontRow  = player.CurrentRowPosition == PhaseHandler.RowPosition.Front && targetPlayer.CurrentRowPosition == PhaseHandler.RowPosition.Front;
        bool isPlayerOnBackRow  = player.CurrentRowPosition == PhaseHandler.RowPosition.Back;
        bool isTargetAlive      = targetPlayer.currentHp > 0;
        bool isPlayerAlive      = player.currentHp > 0;
        bool isBackRowProtected = GetTargetPlayer(PhaseHandler.RowPosition.Front).currentHp > 0;

        //print($"is target alive: {isTargetAlive}");
        //print($"is player alive: {isPlayerAlive}");
        //print($"both on front row (would be ok): {areBothOnFrontRow}");
        //print($"is player on back row (would be ok): {isPlayerOnBackRow}");

        if (isTargetAlive && isPlayerAlive)
        {
            // true if one of them evaluates to true
            // targetting back row from front row is okay while front is dead
            return(areBothOnFrontRow || isPlayerOnBackRow || !isBackRowProtected);
        }

        else
        {
            print("either the attacking player, or the target are dead.");
            return(false);
        }
    }
Example #6
0
    // load a effect-gameobject with the correct prefab
    GameObject LoadNewEffect(Vector3 scale, PlayerProperties targetPlayer)
    {
        Vector3    slightlyRight = new Vector3(0.5f, 0, 0);
        GameObject newEffect;
        GameObject prefabEffective   = Resources.Load <GameObject>("Effects/Epic Toon FX/Prefabs/Combat/Text/KaPow") as GameObject;
        GameObject prefabIneffective = Resources.Load <GameObject>("Effects/Epic Toon FX/Prefabs/Combat/Text/Crack") as GameObject;
        GameObject prefabNormal      = Resources.Load <GameObject>("Effects/Epic Toon FX/Prefabs/Combat/Text/Pow") as GameObject;

        print("entered effectfunction");

        if (effective == true)
        {
            newEffect = Instantiate(prefabEffective, targetPlayer.transform.position + Vector3.up + slightlyRight, player.transform.rotation);
        }
        else if (ineffective == true)
        {
            newEffect = Instantiate(prefabIneffective, targetPlayer.transform.position + Vector3.up + slightlyRight, player.transform.rotation);
        }
        else
        {
            newEffect = Instantiate(prefabNormal, targetPlayer.transform.position + Vector3.up + slightlyRight, player.transform.rotation);
        }

        newEffect.transform.localScale = scale;

        return(newEffect);
    }
Example #7
0
 void Start()
 {
     player           = transform.root.gameObject;
     control          = player.GetComponent <PlayerInputControls>();
     playerInventory  = player.GetComponent <PlayerInventory>();
     playerProperties = player.GetComponent <PlayerProperties>();
     playerController = player.GetComponent <PlayerControllerSinglePlayer>();
     playerStamina    = player.GetComponent <Stamina>();
     playerAmmo       = player.GetComponent <PlayerAmmo>();
     for (int i = 0; i < transform.childCount; i++)
     {
         int tempInt = i;
         itemImage.Add(transform.GetChild(i).transform.GetChild(1).GetComponent <Image>());
         itemButtons.Add(transform.GetChild(i).GetComponent <Button>());
         amountOfText.Add(transform.GetChild(i).transform.GetChild(2).GetComponent <Text>());
         itemImage[i].rectTransform.localPosition = new Vector3(12.8f, -12.8f, 0);
         itemButtons[i].onClick.AddListener(() => ButtonClickFunction(tempInt));
         EventTrigger       trigger = itemButtons[tempInt].GetComponent <EventTrigger>();
         EventTrigger.Entry entry   = new EventTrigger.Entry();
         entry.eventID = EventTriggerType.PointerEnter;
         entry.callback.AddListener((data) => { OnPointerEnterDelegate((PointerEventData)data, tempInt); });
         trigger.triggers.Add(entry);
         numOfItemSlots++;
         UnityEvent rightClickTrigger = transform.GetChild(i).GetComponent <RightClickButton>().rightClick;
         rightClickTrigger.AddListener(() => OnRightClick(tempInt));
     }
     for (int i = 0; i < 6; i++)
     {
         AddInventorySlot();
     }
     playerArmor  = player.GetComponent <PlayerArmor>();
     playerHealth = player.GetComponent <HealthSinglePlayer>();
     weaponSwitch = player.GetComponent <WeaponSwitch>();
 }
Example #8
0
    /// <summary>
    /// Initializes AI. Gets all references, and starts moving.
    /// </summary>
    public void StartAI()
    {
        playerManager = this.GetComponent <PlayerManager>();
        myProperties  = this.GetComponent <PlayerProperties>();
        navMeshAgent  = this.GetComponent <NavMeshAgent>();

        navMeshAgent.speed = myProperties.actualMovSpd;

        controlledLocally = true;

        this.FindNewPoint();

        gamePanels = GameController.instance.GetGamePanels();

        int enemyID = playerManager.myTeam.GetHashCode();

        enemyID++;
        if (enemyID > TeamTypes.Orange.GetHashCode())
        {
            enemyID = 0;
        }

        enemyTeam  = (TeamTypes)enemyID;
        enemyTower = GameController.instance.GetTower(enemyTeam);

        enemies = GameController.instance.GetPlayersOfTeam(enemyTeam);
    }
    void FixedUpdate()
    {
        if (!isServer || (isServer && isClient))
        {
            return;
        }
        NetKeyState keyState;

        while (m_pendingInputs.Count > 0)
        {
            //TODO: cheat detection
            keyState = m_pendingInputs.Dequeue();
            //apply movement
            m_input.Process(keyState.inputData);
            m_messageId = keyState.messageId;
            ProcessActions(m_input.GetInputData());
            m_movement.ProcessInputs(m_input.GetInputData(), Time.fixedDeltaTime);
            PlayerProperties properties = m_movement.GetProperties();

            //add new state to send buffer, respect limit
            while (m_sendBuffer.Count >= c_sendBufferLength)
            {
                m_sendBuffer.RemoveAt(0);
            }
            //pushing the player is not predicted - disable server reconciliation as long as pushing is active
            //if (properties.isPushed) Debug.Log("INHPUSH");
            m_sendBuffer.Add(new ServerState(m_messageId, properties, keyState.inputData, properties.isPushed));

            LagCompensator.Register(gameObject);
        }
    }
        protected override PlayerProperties GetPlayerProperties()
        {
            //TODO:var item = this.GetItem();
            //IPlayerMarkupGenerator generator = MediaFrameworkContext.GetPlayerMarkupGenerator(item);

            var properties = new Dictionary <string, string>();

            if (this.AutoplayCheckbox != null && this.AutoplayCheckbox.Checked)
            {
                properties.Add(BrightcovePlayerParameters.Autoplay, this.AutoplayCheckbox.Value);
            }
            if (this.MutedCheckbox != null && this.MutedCheckbox.Checked)
            {
                properties.Add(BrightcovePlayerParameters.Muted, this.MutedCheckbox.Value);
            }
            properties.Add(BrightcovePlayerParameters.EmbedStyle, this.EmbedInput.Value);
            properties.Add(BrightcovePlayerParameters.Sizing, this.SizingInput.Value);
            properties.Add(BrightcovePlayerParameters.AspectRatio, this.AspectRatioList.Selected.FirstOrDefault().Value);

            var playerProps = new PlayerProperties(properties);

            playerProps.ItemId = this.SourceItemID;
            //TODO:playerProps.Template = item.TemplateID;
            //playerProps.MediaId = generator.GetMediaId(item);
            playerProps.PlayerId = !string.IsNullOrWhiteSpace(this.PlayersList?.Value) ? new ID(this.PlayersList.Value) : new ID();
            playerProps.Width    = Sitecore.MainUtil.GetInt(this.WidthInput.Value, MediaFrameworkContext.DefaultPlayerSize.Width);
            playerProps.Height   = Sitecore.MainUtil.GetInt(this.HeightInput.Value, MediaFrameworkContext.DefaultPlayerSize.Height);
            return(playerProps);
        }
Example #11
0
    /* used for client interpolation */
    public void ProcessInterpolation(PlayerProperties lastProps, PlayerProperties currentProps, float time, bool extrapolate = false)
    {
        Vector3    posOld  = lastProps.position;
        Quaternion rotOld  = lastProps.rotation;
        float      jumpOld = lastProps.jumpTimer;
        Vector3    posCur  = currentProps.position;
        Quaternion rotCur  = currentProps.rotation;
        float      jumpCur = currentProps.jumpTimer;

        m_properties = currentProps;         //make sure all non interpolated properties are up to date
        //BUG: destroys local multiplayer stamina update on collect
        //should never run on client owner, but this function here is shared...
        //m_attributes.SyncSetValue(Attributes.STAMINA, m_properties.stamina);
        if (!extrapolate)
        {
            time = Mathf.Min(time, 1.0f);
        }

        if (time > 1.0f)
        {
            //extrapolate
            ProcessDirectMovement(posOld + (posCur - posOld) * time, rotCur, jumpCur);
        }
        else
        {
            //Interpolate
            Vector3    posLerped  = Vector3.Lerp(posOld, posCur, time);
            Quaternion rotLerped  = Quaternion.Slerp(rotOld, rotCur, time);
            float      jumpLerped = Mathf.Lerp(jumpOld, jumpCur, time);
            ProcessDirectMovement(posLerped, rotLerped, jumpLerped);
        }
    }
Example #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Page.IsPostBack)
            {
                return;
            }

            PlayerProperties properties = new PlayerProperties(this.Request.QueryString);

            var args = new MediaGenerateMarkupArgs
            {
                MarkupType = MarkupType.Html,
                Properties = properties
            };

            MediaGenerateMarkupPipeline.Run(args);

            PlayerManager.RegisterDefaultResources(this.Page);

            if (!args.Aborted)
            {
                this.PlayerContainer.InnerHtml = args.Result.Html;
                this.PlayerContainer.Attributes["data-mf-params"] = properties.ToString();

                PlayerManager.RegisterResources(this.Page, args.Result);
            }
            else
            {
                this.PlayerContainer.InnerHtml = PlayerManager.GetEmptyValue();
            }
        }
Example #13
0
 public void SetProperties(PlayerProperties properties)
 {
     m_properties       = properties;
     transform.position = m_properties.position;
     transform.rotation = m_properties.rotation;
     //controller.isGrounded will be set indirectly due to transform update
 }
    public override void doAction()
    {
        GameObject       player           = GameObject.FindGameObjectWithTag("Player");
        PlayerProperties playerProperties = (PlayerProperties)player.GetComponent(typeof(PlayerProperties));

        playerProperties.healFor(heal);
    }
Example #15
0
        public bool OpCreateRoomWithProperties(string roomName, RoomOptions options, TypedLobby lobby)
        {
            PlayerProperties.CreatePlayerHashtable();
            options.CustomRoomProperties = RoomProperties.GetRoomHashtable();

            return(OpCreateRoom(roomName, options, lobby));
        }
Example #16
0
    private IEnumerator Start()
    {
        PlayerProperties.CreatePlayerHashtable();

        // initialize
        Transform t;

        t = transform.Find("Players");
        playerTranformLeft   = t.Find("Clients_Left");
        playerTransformRight = t.Find("Clients_Right");

        playerPrefab = playerTranformLeft.GetChild(0).gameObject;
        playerPrefab.SetActive(false);

        playerDictionary = new Dictionary <int, CharacterSelectPortrait>();

        // wait for mode choice
        while (ModeSelect.Mode == 0)
        {
            yield return(null);
        }

        // Online
        // Create portraits based on who's connected
        if (ModeSelect.Mode == 2)
        {
            var players = NetworkManager.getSortedPlayers;
            foreach (var p in players)
            {
                AddPlayer(p.ID);
            }
        }
    }
    void Awake()
    {
        enemyAI = gameObject.GetComponent <EnemyBehaviourAggressive>();
        GameObject go = GameObject.FindGameObjectWithTag("Player");

        player = go.GetComponent <PlayerProperties>();
    }
Example #18
0
    private void Start()
    {
        drawPoints = new List <Vector3>();

        prop = GetComponent <PlayerProperties>();

        if (GetComponent <PlayerProperties>().PlayerID == 1)
        {
            direction  = Vector3.right;
            MyBrush    = GameManager.Player.GetPlayerBrush(1);
            myBeam     = GameManager.Player.RedBeamPrefabs;
            myParticle = prop.SprayParticles[0];

            GameManager.Player.PlayerLines[0].receiveShadows = false;
        }

        if (GetComponent <PlayerProperties>().PlayerID == 2)
        {
            direction  = Vector3.left;
            MyBrush    = GameManager.Player.GetPlayerBrush(2);
            myBeam     = GameManager.Player.BlueBeamPrefabs;
            myParticle = prop.SprayParticles[1];

            GameManager.Player.PlayerLines[1].receiveShadows = false;
        }

        myParticle.transform.GetChild(0).gameObject.SetActive(false);
        myParticle.Stop();
    }
        public ActionResult RenderVideo()
        {
            Rendering rendering = RenderingContext.Current.Rendering;

            if (!ID.IsID(rendering.DataSource))
            {
                var emptyArgs = new MediaGenerateMarkupArgs();
                emptyArgs.AbortPipeline();

                return(this.View(this.RenderVideoViewPath, emptyArgs));
            }

            PlayerProperties properties = new PlayerProperties(rendering.Parameters.ToDictionary(p => p.Key, p => p.Value))
            {
                ItemId = new ID(rendering.DataSource)
            };

            var args = new MediaGenerateMarkupArgs
            {
                MarkupType = MarkupType.Html,
                Properties = properties,
            };

            MediaGenerateMarkupPipeline.Run(args);

            return(this.View(this.RenderVideoViewPath, args));
        }
Example #20
0
 // Use this for initialization
 void Start()
 {
     playerProperties = GetComponent <PlayerProperties>();
     cam = playerProperties.cam;
     camDefaultPosition = cam.transform.localPosition;
     control            = GetComponent <PlayerInputControls>();
 }
    void Start()
    {
        GameObject player = GameObject.FindGameObjectWithTag("Player");

        playerInvent     = player.GetComponent <PlayerInventory>();
        playerProperties = player.GetComponent <PlayerProperties>();
    }
Example #22
0
    // Update is called once per frame
    void Update()
    {
        numPlayersDead = 0;
        foreach (var player in players)
        {
            PlayerProperties playerProperties = player.gameObject.GetComponent <PlayerProperties>();
            print("player" + playerProperties.playerID + " health:" + playerProperties.playerHealth);
            print("player" + playerProperties.playerID + " spec:" + playerProperties.isSpectator);
            if (player.gameObject.GetComponent <PlayerProperties>().isSpectator)
            {
                print("found spectator");
                numPlayersDead++;
            }
        }

        if (players.Length != 1)
        {
            if (numPlayersDead >= players.Length - 1)
            {
                StartCoroutine("ChangeScene", 0);
            }
        }


        //print(numPlayersInRoom);
    }
Example #23
0
 // Start is called before the first frame update
 void Start()
 {
     // access specific PlayerProperties of the gameobject where this script is attached to
     player = gameObject.GetComponent <PlayerProperties>();
     playerMinifigController = gameObject.transform.parent.GetComponent <MinifigControllerGroupW>();
     leftHandPosition        = player.leftHandPosition;
 }
        protected virtual void InsertMedia(PlayerProperties playerProperties)
        {
            if (playerProperties == null)
            {
                return;
            }

            var args = new MediaGenerateMarkupArgs
            {
                MarkupType = MarkupType.Frame,
                Properties = playerProperties
            };

            MediaGenerateMarkupPipeline.Run(args);

            switch (this.Mode)
            {
            case "webedit":
                SheerResponse.SetDialogValue(args.Result.Html);
                this.EndWizard();
                break;

            default:
                SheerResponse.Eval("scClose(" + StringUtil.EscapeJavascriptString(args.Result.Html) + ")");
                break;
            }
        }
        public void OnPreprocessBuild(BuildReport report)
        {
            PlayerProperties playerPropertiesAsset = Resources.Load <PlayerProperties>(PlayerProperties.ASSET_NAME);

            if (playerPropertiesAsset.RestoreOnBuild)
            {
                playerPropertiesAsset.Restore();
            }

            QuestAsset questAsset = Resources.Load <QuestAsset>(QuestAsset.ASSET_NAME);

            if (questAsset.RestoreOnBuild)
            {
                questAsset.Restore();
            }

            IntroductionAsset introAsset = Resources.Load <IntroductionAsset>(IntroductionAsset.ASSET_NAME);

            if (introAsset.RestoreOnBuild)
            {
                introAsset.Restore();
            }

            MiniGameSettingAsset minigameAsset = Resources.Load <MiniGameSettingAsset>(MiniGameSettingAsset.ASSET_NAME);

            if (minigameAsset.RestoreOnBuild)
            {
                minigameAsset.Restore();
            }

            Debug.Log($"Tried restoring scriptable object assets");
        }
Example #26
0
    void OnTriggerEnter2D(Collider2D other)
    {
        float power = curve.Evaluate(curLife);

        if (other != null && other.gameObject != null)
        {
            if (owner != other.gameObject)
            {
                // This object is player and has no shield protecting it?
                PlayerProperties pl = other.gameObject.GetComponent <PlayerProperties>();

                if (pl && !pl.shieldActivated)
                {
                    pl.hit(power * damage, owner);
                }

                // This object is shield??
                // Then we must to hit it
                Shield shield = other.gameObject.GetComponent <Shield>();
                if (shield)
                {
                    shield.hit(power * damage, owner);
                }
            }
        }
    }
 public ServerState(int id, PlayerProperties plProperties, int input, bool inhibit)
 {
     messageId             = id;
     properties            = plProperties;
     inputData             = input;
     inhibitReconciliation = inhibit;
 }
 // Use this for initialization
 void Start()
 {
     if (startPoint != null) //if there's an object in startPoint transform
     {
         this.transform.position = startPoint.position;
     }
     pProp = GetComponent<PlayerProperties>();
 }
Example #29
0
 public void UpdateSidebarStats(PlayerProperties properties)
 {
     sidebarLifeText.text     = properties.baseHP + " + " + properties.hpModifier;
     sidebarDefenseText.text  = properties.baseDef + " + " + properties.defModifier;
     sidebarDamageText.text   = properties.baseAtk + " + " + properties.atkModifier;
     sidebarMovSpeedText.text = properties.baseMovSpd + " + " + properties.movSpdModifier;
     sidebarClipSizeText.text = properties.baseFireRate + " + " + properties.fireRateModifier;
 }
Example #30
0
 public void Other()
 {
     PlayerProperties.Reset();
     Economy.mEconomyState = Economy.mEconomyState == Economy.EconomyState.GlobalRecession ?
                             Economy.EconomyState.Overheating :
                             Economy.EconomyState.GlobalRecession;
     SceneTransitionManager.StartTransition("Map");
 }
	void Start()
	{
		cc = GetComponent<CharacterController>();
		pp = GetComponent<PlayerProperties>();
		
		defCameraHt = Camera.main.transform.localPosition.y;
		minCameraHt = defCameraHt - defCameraHt / 2;
	}
Example #32
0
 internal virtual void Awake()
 {
     _playerProperties = new PlayerProperties();
     _playerProperties.Character = GameObject.FindGameObjectWithTag(gameObject.tag);
     _playerProperties.RigidBody = _playerProperties.Character.GetComponent<Rigidbody2D>();
     _playerProperties.RightPointToJump = GameObject.Find("RightPointToJump");
     _playerProperties.LeftPointToJump = GameObject.Find("LeftPointToJump");
 }
Example #33
0
 private void Awake()    //Find relevant objects
 {
     _hud = GameObject.Find("HUD Manager").GetComponent <HUDManager>();
     _playerProperties   = transform.GetComponent <PMovement>().objectParameters;
     _playerInput        = GetComponent <PlayerInput>();
     _bullletInformation = bullet.GetComponent <ProjectileObject>();
     AddNewWeapon(bullet);
 }
    /// <summary>
    /// Index from myGuns array, defining the active gun.
    /// </summary>
   // int activeGunIndex;

    /// <summary>
    /// Initializes shooter system.
    /// </summary>
    public void Start()
    {
        myGuns = new GunTypes[] { GunTypes.Default, GunTypes.None };
       // activeGunIndex = 0;

        timeSinceLastBullet = Time.time;

        playerManager = GetComponent<PlayerManager>();
        myProperties = GetComponent<PlayerProperties>();
    }
    void Start()
    {
        GameObject playerGameObject = GameObject.Find("hero");					//get player and set to pProp
        pProp = playerGameObject.GetComponent<PlayerProperties>();

        speechManager = GameObject.FindWithTag("kinect-speech").GetComponent<SpeechManager>();
        intManager = GameObject.FindWithTag("kinect-interaction").GetComponent<InteractionManager>();
        heartIcon = GameObject.Find("heart_icon").GetComponent<GUITexture>();

        //coins and lives are slightly bigger if using a larger screen
        livesText.fontSize = Screen.width/40;
        if (livesText.fontSize < 20) livesText.fontSize = 20; //impose min size restriction
        coinsText.fontSize = livesText.fontSize;
    }
 //apply pickup to Player
 void ApplyPickup(PlayerProperties playerStatus)
 {
     switch (pickupType)
     {
     case PickupType.Grow:
         if ((int)playerStatus.playerState == (int)PlayerProperties.PlayerState.PlayerSmall)
         {
             playerStatus.playerState = PlayerProperties.PlayerState.PlayerLarge; //change playerState to large if Player small
             playerStatus.changePlayer = true;				//enable Player to change states
         }
         break;
     case PickupType.Coin:
         playerStatus.AddCoin(pickupValue);	//add a coin to the current coin count
         break;
     case PickupType.ExtraLife:
         playerStatus.lives +=  pickupValue; //add a life to the current life amount
         break;
     }
 }
Example #37
0
    public int ApplyPowerUp(PlayerProperties playerStatus)
    {
        switch (powerUpType)
        {
        case PowerType.Projectile :
            if(playerStatus.playerState == PlayerProperties.PlayerState.CarNormal)
            {
                Debug.Log("We have a projectile!");
                playerStatus.playerState = PlayerProperties.PlayerState.CarProjectile;
                playerStatus.hasProjectile = true;
                playerStatus.changeState = true;
            }
            break;

        case PowerType.Trap :
            if(playerStatus.playerState == PlayerProperties.PlayerState.CarNormal)
            {
                Debug.Log("We have a trap!");
                playerStatus.playerState = PlayerProperties.PlayerState.CarTrap;
                playerStatus.hasTrap = true;
                playerStatus.changeState = true;
            }
            break;

        case PowerType.Boost :
            if(playerStatus.playerState == PlayerProperties.PlayerState.CarNormal)
            {
                Debug.Log("We have a boost!");
                playerStatus.playerState = PlayerProperties.PlayerState.CarBoost;
                playerStatus.hasBoost = true;
                playerStatus.changeState = true;
            }
            break;
        }
        return (int)powerUpType;
    }
 void Start()
 {
     pProp = GameObject.FindWithTag("Player").GetComponent<PlayerProperties>();
 }
    /// <summary>
    /// Initializes AI. Gets all references, and starts moving.
    /// </summary>
    public void StartAI()
    {
        playerManager = this.GetComponent<PlayerManager>();
        myProperties = this.GetComponent<PlayerProperties>();
        navMeshAgent = this.GetComponent<NavMeshAgent>();

        navMeshAgent.speed = myProperties.actualMovSpd;

        controlledLocally = true;

        this.FindNewPoint();

        gamePanels = GameController.instance.GetGamePanels();

        int enemyID = playerManager.myTeam.GetHashCode();
        enemyID++;
        if (enemyID > TeamTypes.Orange.GetHashCode())
        {
            enemyID = 0;
        }

        enemyTeam = (TeamTypes)enemyID;
        enemyTower = GameController.instance.GetTower(enemyTeam);

        enemies = GameController.instance.GetPlayersOfTeam(enemyTeam);
    }
    /// <summary>
    /// Start method. Gets all references.
    /// </summary>
    public void StartPlayer(bool playerControlled, TeamTypes myTeam, string playerPlayFabID, string playFabName)
    {
        this.playerPlayFabID = playerPlayFabID;
        this.myTeam = myTeam;
        this.playerControlled = playerControlled;
        this.playerPlayFabName = playFabName;

        myProperties = this.GetComponent<PlayerProperties>();
        networkLayer = this.GetComponent<PlayerNetworkLayer>();
        animationManager = this.GetComponent<PlayerAnimationManager>();
        shooterManager = this.GetComponent<ShooterManager>();
        aiManager = this.GetComponent<PlayerAIManager>();

        shooterManager.CreateBuffer(myTeam);

        myTower = GameController.instance.GetTower(myTeam);

        playerExp = playerLevel = 0;

        myProperties.Initialize();

        baseSprite.color = spriteTeamColors[myTeam.GetHashCode()];

        Debug.Log("initializing player. is human? " + playerControlled+" is local? "+networkLayer.isMine);
        if (networkLayer.isMine)
        {
            if (playerControlled)
            {
                Camera.main.transform.SetParent(this.transform, true);

                //levelText = GameController.instance.GetLevelText();
                expText = GameController.instance.GetExpText();

                GameplayUI.instance.Initialize(myTeam,this);
                GameplayUI.instance.UpdateSidebarStats(myProperties);

                InGameStoreAndCurrencyManager.instance.SetUpgradesCallbacks(new ProjectDelegates.OnPlayerBoughtStatUpgradeCallback[]{
                    myProperties.IncreaseAtk,myProperties.IncreaseMovSpd,myProperties.IncreaseHP
                });
            }

            this.transform.position = GameController.instance.GetRandomSpawnPoint(myTeam);
        }
    }
 // Use this for initialization
 void Start()
 {
     player = GameObject.Find ("Player");
     pp = player.GetComponent<PlayerProperties> ();
 }
 // Use this for initialization
 void Start()
 {
     playerLink = GameObject.FindGameObjectWithTag("Player");
     pProp = playerLink.GetComponent<PlayerProperties>();
     pControls = playerLink.GetComponent<PlayerControls>();
 }
Example #43
0
 /// <summary>
 /// Creates the playerproperties object which holdes the information and 
 /// does not get destroyed when loading the maps
 /// </summary>
 private void CreatePlayerProperties()
 {
     playerPropertiesGO = new GameObject("PlayerProperties");
     playerProperties = playerPropertiesGO.AddComponent<PlayerProperties>();
 }
	void Start()
	{
		pp = GetComponent<PlayerProperties>();
	}
 void Start()
 {
     tongue = transform.FindChild ("Tongue parent");
     playerProps = GetComponent<PlayerProperties> ();
     tongueOriginalScale = tongue.localScale;
     tongueOriginalPosition = tongue.localPosition;
 }
    // Use this for initialization
    void Start()
    {
        controller = GetComponent <PlayerControlScript> ();
        anim = GetComponentInChildren<AnimationScript>();
        properties = GetComponent<PlayerProperties>();

        /*facingRight = properties.facingRight;
        jumpForce = properties.jumpForce;
        moveForce = properties.moveForce;			// Amount of force added to move the player left and right.
        maxSpeed = properties.maxSpeed;
        jumpTimer = properties.jumpTimer;
        float moveTimer = properties.moveTimer;*/
    }
    void Start()
    {
        pmc = GameObject.FindWithTag("kinect-pointMan").GetComponent<PointManController>();
        player = GameObject.FindWithTag("Player");

        lProp = GameObject.Find("levelProperties").GetComponent<LevelProperties>();
        pProp = GameObject.Find("hero").GetComponent<PlayerProperties>();
    }
Example #48
0
	int GetKey(PlayerProperties pp, GameObject door)
	{
		List<Color> keys = pp.keys;
		
		for (int i = 0; i < keys.Count; i++)
		{
			if (ToHex(keys[i]) == ToHex(Color.yellow) && door.transform.GetChild(0).GetComponent<MeshRenderer>().material.color == new Color(0.5f, 0.2f, 0, 0) ||
			    keys[i] == door.transform.GetChild(0).GetComponent<MeshRenderer>().material.color)
			    return i;
		}
		return -1;
	}
    void Start()
    {
        playerLayerMask = LayerMask.NameToLayer("Player");
        platformLayerMask = LayerMask.NameToLayer("Platforms");
        //groundLayerMask = LayerMask.NameToLayer("Ground");

        controller = GetComponent<CharacterController>();
        controller.center = new Vector3(0, centerY, 0);

        graphics.transform.localScale = new Vector3(scaleX, scaleY, 0.1f);
        //transform.localScale = new Vector3(scaleX, scaleY, 0.1f);

        sprite = GetComponent<AnimationSprite>();
        sprite.AnimateSprite(4, 4, 0, 0, 14, 24);

        //playerSoundScript = GetComponent<PlayerSound>();
        playerProperties = GetComponent<PlayerProperties>();
    }
Example #50
0
 void Start()
 {
     playerGameObject = GameObject.FindGameObjectWithTag("Player");
     playerProperties = playerGameObject.GetComponent<PlayerProperties>();
 }
	void Awake() {
		//singleton
		if (inst == null) {
			inst = this;
		}
		shealth = defaultHealth;
	}
Example #52
0
 void Start()
 {
     sprite = GetComponent<UISprite>();
     player = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerProperties>();
 }
 public void UpdateSidebarStats(PlayerProperties properties)
 {
     sidebarLifeText.text = properties.baseHP + " + " + properties.hpModifier;
     sidebarDefenseText.text = properties.baseDef + " + " + properties.defModifier;
     sidebarDamageText.text = properties.baseAtk + " + " + properties.atkModifier;
     sidebarMovSpeedText.text = properties.baseMovSpd + " + " + properties.movSpdModifier;
     sidebarClipSizeText.text = properties.baseFireRate + " + " + properties.fireRateModifier;
 }
 // Use this for initialization
 void Start()
 {
     anim = GetComponentInChildren<RyuAnimationScript>();
     properties = GetComponent<PlayerProperties>();
 }