示例#1
0
 public void PickUp(s_Player p)
 {
     if (p != null && p.GetEquippedWeapon() == null && holder == null)
     {
         onPickUp(p);
     }
 }
 public void OnSpawn(s_Player myPlayer)
 {
     owningPlayer = myPlayer;
     owningPlayer.AddSBlock(this);
     mySystem        = GetComponentInChildren <ParticleSystem>(); //gets referance to particle system
     defaultSimSpeed = mySystem.main.simulationSpeed;             //set the default speed of the system i.e. what it will return to when unpaused
 }
    void swing()
    {
        deflect();
        swingTimer.SetTimerShouldCountDown(true);
        Vector3         forward    = holder.GetAimDirection();
        List <s_Player> swingables = s_GameManager.Singleton.GetPlayersOnTeam(holder.GetTeam(), true);

        resetArcs();
        for (int i = 0; i < swingables.Count; i++)
        {
            if (s_Calculator.GetDistanceLessThan(holder.transform.position, swingables[i].transform.position, Range))
            {
                Vector3  dirToTarget = holder.transform.position - swingables[i].transform.position;
                float    dotResult   = Vector3.Dot(dirToTarget.normalized, forward.normalized);
                s_Player swingy      = swingables[i];
                if (dotResult < 0 && swingy.GetCurrentState() != s_Player.States.Dead)
                {
                    if (dotResult * -1 > swingArc.arc)
                    {
                        swingy.TakeKnockBack(-dirToTarget.normalized, SwingForce, 0, true);
                        onImpact();
                        swingy.TakeDamage(Damage);
                        reduceDurability();
                    }
                }
            }
        }
    }
示例#4
0
 public Game()
 {
     player1     = new s_Player();
     camera      = new s_Camera();
     UI_Data     = new s_UIData();
     enemy       = new s_Enemy();
     s_enemyList = new List <s_Enemy>();
 }
示例#5
0
    void onExit(Collider c)
    {
        s_Player p = c.gameObject.GetComponent <s_Player>();

        if (p != null)
        {
            p.SetOverlapped(this);
        }
    }
示例#6
0
 public void onPickUp(s_Player p)
 {
     if (p.SetEquippedWeapon(this)) // checks to make the weapon is not one just dropped if it is not then it equips it and continues
     {
         AudioControlerScript.PlaySound(AudioControlerScript.Clips.pickup_gun_001);
         SetHolder(p);
         p.AddWeaponToHand(this);
         holderColor = p.PlayerColor;
         tossed      = null;
         p.PlayPickupSound();
         doPickUpEffect();
     }
 }
    // Start is called before the first frame update
    public void InitializeControls()
    {
        KeyCode[] myKeyCodes = (KeyCode[])Enum.GetValues(typeof(KeyCode));
        myPlayer       = GetComponent <s_Player>();
        xboxController = (XboxController)myPlayer.GetPlayerID() + 1;

        for (int i = 0; i < myKeyCodes.Length; i++)
        {
            myKeys.Add(new Nothing(myPlayer, 0));
            keyCodeMyKeysLocation.Add(new KeyValuePair <int, int>((int)myKeyCodes[i], i));
        }

        XboxAxis[] myContInput = (XboxAxis[])Enum.GetValues(typeof(XboxAxis));
        for (int i = 0; i < myContInput.Length; i++)
        {
            myXCIAxis.Add(new NothingA(myPlayer, ""));
            XCIMyKeysLocation.Add(new KeyValuePair <int, int>((int)myContInput[i], i));
        }

        XboxButton[] myContButtonInput = (XboxButton[])Enum.GetValues(typeof(XboxButton));
        for (int i = 0; i < myContButtonInput.Length; i++)
        {
            myXCIButtons.Add(new NothingA(myPlayer, ""));
            XCIMyKeyButtonLocation.Add(new KeyValuePair <int, int>((int)myContButtonInput[i], i));
        }

        keyCodeMyKeysLocation.Sort((x, y) => x.Key.CompareTo(y.Key));
        XCIMyKeysLocation.Sort((x, y) => x.Key.CompareTo(y.Key));
        XCIMyKeyButtonLocation.Sort((x, y) => x.Key.CompareTo(y.Key));

        if (InputManagerA.GetInputLibrary() == InputManagerA.InputLibrary.InControl)
        {
            if (myPlayer.GetPlayerID() < InputManager.Devices.Count)
            {
                m_controllerDevice = InputManager.Devices[myPlayer.GetPlayerID()];
            }
            else
            {
                if (!myPlayer.GetAI() && myPlayer.GetPlayerID() > InputManager.Devices.Count + 1)
                {
                    s_ErrorMessage.AddMesage("Error Connecting controllers");
                }
            }
        }
        setDefaultControls();
        for (int i = 0; i < m_inControlWrappers.Count; i++)
        {
            m_inControlWrappers[i].ControlNotInUse();
        }
    }
    public string getProperAxisName(s_Player p, int axisNumber, string axisPrefix = "")
    {
        switch (axisNumber)
        {
        case 1:
            return(axisPrefix + "Horizontal" + "p" + p.GetPlayerID().ToString());

        case 2:
            return(axisPrefix + "Vertical" + "p" + p.GetPlayerID().ToString());

        default:
            return(axisPrefix + "Axis" + axisNumber.ToString() + "p" + p.GetPlayerID().ToString());
        }
    }
 void Start()
 {
     myPlayer = GetComponent <s_Player>();
     myBody   = GetComponent <Rigidbody>();
     if (myPlayer.GetTeam() == 0)
     {
         setDirection(transform.right);
         aimDirection = transform.right;
     }
     else
     {
         setDirection(transform.right * -1);
         aimDirection = transform.right * -1;
     }
 }
    // Update is called once per frame
    void Update()
    {
        if (owningPlayer == null)
        {
            if (FindPlayer.CountDownAutoCheckBool())
            {
                owningPlayer = FindObjectOfType <s_Player>();
            }
        }
        if (s_GameManager.Singleton.GetPauseState())
        {
            return;
        }

        withOwningPlayer();
        fallIfNothingSupporting();
    }
示例#11
0
    protected virtual void OnEnter(Collider c)
    {
        s_Player p = c.gameObject.GetComponent <s_Player>();

        if (p != null)
        {
            p.SetOverlapped(this);
        }
        if (mySpawnPoint != null && p != null && p.GetEquippedWeapon() == null)
        {
            mySpawnPoint.SetCurrentWeapon(null);
            mySpawnPoint = null;
            transform.SetParent(null);
        }
        if (p != null && p.GetEquippedWeapon() == null && holder == null && !p.GetAI() && p.GetCurrentState() != s_Player.States.Dead)
        {
            onPickUp(p);
        }
    }
示例#12
0
 public void SetHolder(s_Player toHold)
 {
     holder = toHold;
     if (toHold == null)
     {
         holderColor = Color.white;
         if (m_myOutline != null)
         {
             m_myOutline.enabled = true;
         }
     }
     else
     {
         holderColor = toHold.PlayerColor;
         if (m_myOutline != null)
         {
             m_myOutline.enabled = false;
         }
     }
     if (tossed == null)
     {
         checkIfEmpty();
     }
 }
 public DropWeapon(s_Player p, XboxButton kc) : base(p, kc)
 {
 }
 public Kick(s_Player p, KeyCode kc) : base(p, kc)
 {
 }
 public RotateRight(s_Player p, KeyCode kc) : base(p, kc)
 {
 }
 public RotateLeft(s_Player p, KeyCode kc) : base(p, kc)
 {
 }
 public Kick(s_Player p, XboxButton kc) : base(p, kc)
 {
 }
 public void SetOwningPlayer(s_Player player)
 {
     owningPlayer = player;
 }
 public CommandA(s_Player p, XboxButton kc)
 {
     myPlayer = p;
     xbb      = kc;
 }
 public MoveEast(s_Player p, KeyCode kc) : base(p, kc)
 {
 }
 public FireWeaponSecondary(s_Player p, KeyCode kc) : base(p, kc)
 {
 }
 public Dodge(s_Player p, XboxButton kc) : base(p, kc)
 {
 }
 public Dodge(s_Player p, KeyCode kc) : base(p, kc)
 {
 }
 public Nothing(s_Player p, KeyCode kc) : base(p, kc)
 {
 }
 public DropWeapon(s_Player p, KeyCode kc) : base(p, kc)
 {
 }
 public CommandA(s_Player p, KeyCode kc)
 {
     myPlayer = p;
     keyCode  = kc;
 }
 public MoveBack(s_Player p, KeyCode kc) : base(p, kc)
 {
 }
 public MoveForward(s_Player p, KeyCode kc) : base(p, kc)
 {
 }
 public MoveSouth(s_Player p, KeyCode kc) : base(p, kc)
 {
 }
 public FireWeapon(s_Player p, KeyCode kc) : base(p, kc)
 {
 }