コード例 #1
0
    void Start()
    {
        // Hide menu
        menu.SetActive(false);

        // ** Create architect player ** //
        GameObject newArchitect = GameObject.Instantiate(ArchitectPrefab, architectSpawnLocation.transform.position, Quaternion.identity) as GameObject;

        ArchitectPawn = newArchitect.GetComponent <ArchitectPawn>();

        // ** Create builder players ** //
        bool[] connectedControllers = MP_Input.GetConnectedControllers();

        for (int i = 0; i < connectedControllers.Length; i++)
        {
            if (connectedControllers[i])
            {
                MP_InputDeviceInfo device = new MP_InputDeviceInfo(MP_eInputType.Controller, i);

                GameObject newBuilder = GameObject.Instantiate(BuilderPrefab, builderSpawnLocations[i].transform.position, Quaternion.identity) as GameObject;

                BuilderPawn newBuilderPawn = newBuilder.GetComponent <BuilderPawn>();

                if (newBuilderPawn != null)
                {
                    newBuilder.GetComponent <BuilderHealth>().onPlayerDeath += CheckIfAllPlayerDead;
                    newBuilderPawn.Initialize(device);
                    BuilderPawns.Add(newBuilderPawn);
                }
            }
        }
    }
コード例 #2
0
    public virtual void Drop()
    {
        CurrentOwner = null;
        GridPosition gridPos = GameGrid.Instance.WorldToGridPosition(this.transform.position);

        this.transform.position = GameGrid.Instance.GridToWorldSpace(gridPos);
    }
コード例 #3
0
    protected virtual void OnTriggerExit(Collider aCollider)
    {
        if (aCollider.gameObject.GetComponent <BuilderPawn>() != null)
        {
            BuilderPawn builderPawn = aCollider.gameObject.GetComponent <BuilderPawn>();

            builderPawn.NearbyResources.Remove(this);
        }
    }
コード例 #4
0
ファイル: Building.cs プロジェクト: ErikUggeldahl/GGJ15
    protected virtual void OnTriggerEnter(Collider aCollider)
    {
        if (aCollider.gameObject.GetComponent <BuilderPawn>() != null)
        {
            BuilderPawn builderPawn = aCollider.gameObject.GetComponent <BuilderPawn>();

            builderPawn.NearbyBuildings.Add(this);
        }
    }
コード例 #5
0
 protected virtual void OnTriggerExit(Collider aCollider)
 {
     if (aCollider.gameObject.GetComponent <BuilderPawn>() != null)
     {
         //if (aCollider.gameObject.GetComponent<BuilderPawn>() != this)
         //{
         NearbyPlayer = null;
         // }
     }
 }
コード例 #6
0
ファイル: ArchitectPawn.cs プロジェクト: ErikUggeldahl/GGJ15
    protected override void OnTriggerExit(Collider aCollider)
    {
        if (aCollider.gameObject.GetComponent <BuilderPawn>() != null)
        {
            BuilderPawn builderPawn = aCollider.gameObject.GetComponent <BuilderPawn>();

            if (builderPawn.NearbyBuildings.Contains(this))
            {
                builderPawn.NearbyBuildings.Remove(this);
            }
        }
    }
コード例 #7
0
    protected virtual void OnTriggerEnter(Collider aCollider)
    {
        if (aCollider.gameObject.GetComponent <BuilderPawn>() != null)
        {
            // if (aCollider.gameObject.GetComponent<BuilderPawn>() != this)
            // {
            BuilderPawn builderPawn = aCollider.gameObject.GetComponent <BuilderPawn>();

            NearbyPlayer = builderPawn;
            //}
        }
    }
コード例 #8
0
ファイル: ArchitectPawn.cs プロジェクト: ErikUggeldahl/GGJ15
    protected override void OnTriggerEnter(Collider aCollider)
    {
        if (aCollider.gameObject.GetComponent <BuilderPawn>() != null)
        {
            BuilderPawn builderPawn = aCollider.gameObject.GetComponent <BuilderPawn>();

            if (builderPawn.BuilderHealthScript.IsAlive)
            {
                if (builderPawn.IsHoldingPlayer)
                {
                    builderPawn.CurrentHeldPlayer.BuilderHealthScript.Respawn();

                    builderPawn.DropItem();
                }
                else
                {
                    builderPawn.NearbyBuildings.Add(this);
                }
            }
        }
    }
コード例 #9
0
ファイル: BuilderInput.cs プロジェクト: ErikUggeldahl/GGJ15
 public void Initialize(BuilderPawn aPawn, MP_InputDeviceInfo aInputDeviceInfo)
 {
     pawn            = aPawn;
     inputDeviceInfo = aInputDeviceInfo;
 }
コード例 #10
0
ファイル: BuilderHealth.cs プロジェクト: ErikUggeldahl/GGJ15
 public void Initialize(BuilderPawn aPawn)
 {
     pawn = aPawn;
 }
コード例 #11
0
 public virtual void Pickup(BuilderPawn aPawn)
 {
     CurrentOwner = aPawn;
 }
コード例 #12
0
 public void Hold(BuilderPawn aPawn)
 {
     CurrentOwner = aPawn;
 }