コード例 #1
0
ファイル: ReactorScript.cs プロジェクト: TopHatJoe/couchRogue
    //private SystemScript systemScr;



    void Start()
    {
        sysScr  = gameObject.GetComponent <SystemScript> ();
        gridPos = sysScr.GridPos;

        GameObject _ship = transform.parent.parent.parent.parent.gameObject;

        pwrMngr          = _ship.GetComponent <ShipPowerMngr> ();
        hScr             = gameObject.GetComponent <HealthScript> ();
        originReactorScr = GetOriginReactor();

        originReactorScr.fullCapacity += componentCapacity;
        if (this == originReactorScr)
        {
            isOrigin = true;
        }

        //ReactorSetup ();

        //if !inEditor
        if (CasheScript.Instance.GameMode != 0)
        {
            pwrMngr.PowerSetup(systemType, componentCapacity);

            if (isOrigin)
            {
                pwrMngr.AddToSysScrList(systemType, sysScr);
            }
        }
    }
コード例 #2
0
    public void HideMoves()
    {
        foreach (GameObject card in cardMoves)
        {
            card.GetComponent <CardScript>().GlowOff();
        }

        foreach (GameObject card in cardMatches)
        {
            card.GetComponent <CardScript>().GlowOff();
        }

        foreach (GameObject card in foundationMoves)
        {
            card.GetComponent <FoundationScript>().GlowOff();
        }

        if (reactorMove != null)
        {
            ReactorScript reactorMoveScript = reactorMove.GetComponent <ReactorScript>();

            // re-enable the top cards hitbox because it was disabled for the reactors hitbox to be on top
            // the top card can normally be clicked and dragged to match with other cards
            if (reactorMoveScript.cardList.Count != 0)
            {
                reactorMoveScript.cardList[0].GetComponent <BoxCollider2D>().enabled = true;
            }

            reactorMoveScript.GlowOff();
        }
    }
コード例 #3
0
    // Use this for initialization
    void Awake()
    {
        //myCam = GameObject.Find("Main Camera");
        myTransform = transform;
        myCamera = Camera.main;

        ScriptRef = gameObject.GetComponent<ReactorScript>();
        PlayerRef = GameObject.FindGameObjectWithTag("Player");

        MaxHealth = ScriptRef.StartingHealth;
    }
コード例 #4
0
    void Awake()
    {
        engineGO = GameObject.Find("Engines");
        lifeSupportGO = GameObject.Find("Life Support");
        reactorGO = GameObject.Find("Reactor");
        repairTextGO = GameObject.Find("IsRepairing");

        engineWorkArea = GameObject.Find("EngineWorkArea").GetComponent<RepairTrigger>();
        lifeSupportWorkArea = GameObject.Find("LifeSupportWorkArea").GetComponent<RepairTrigger>();
        reactorWorkArea = GameObject.Find("ReactorWorkArea").GetComponent<RepairTrigger>();

        lifeSupport = lifeSupportGO.GetComponent<LifeSupportScript>();
        engines = engineGO.GetComponent<EnginesScript>();
        reactor = reactorGO.GetComponent<ReactorScript>();
    }
コード例 #5
0
    public void ShowMoves(GameObject selectedCard)
    {
        cardMoves.Clear();
        cardMatches.Clear();
        foundationMoves.Clear();
        reactorMove = null;

        FindMoves(selectedCard);

        foreach (GameObject card in cardMoves)
        {
            card.GetComponent <CardScript>().GlowOn(false);
        }

        foreach (GameObject card in cardMatches)
        {
            card.GetComponent <CardScript>().GlowOn(true);
        }

        foreach (GameObject card in foundationMoves)
        {
            card.GetComponent <FoundationScript>().GlowOn();
        }

        if (reactorMove != null)
        {
            ReactorScript reactorMoveScript = reactorMove.GetComponent <ReactorScript>();

            // disable the top cards hitbox for the reactors hitbox to be on top
            // the top card can normally be clicked and dragged to match with other cards
            if (reactorMoveScript.cardList.Count != 0)
            {
                reactorMoveScript.cardList[0].GetComponent <BoxCollider2D>().enabled = false;
            }

            // if moving the card into the reactor will lose us the game
            if (reactorMoveScript.CountReactorCard() +
                selectedCard.GetComponent <CardScript>().cardVal >= Config.config.maxReactorVal)
            {
                reactorMoveScript.GlowOn(2);
            }
            else
            {
                reactorMoveScript.GlowOn(1);
            }
        }
    }
コード例 #6
0
        public void LoadReactorScripts()
        {
            foreach (var scripttemplate in ServerContext.GlobalReactorCache.Select(i => i.Value))
            {
                ReactorScript scp = ScriptManager.Load <ReactorScript>(scripttemplate.ScriptKey, scripttemplate);

                if (scp != null && scp.Reactor != null)
                {
                    if (LastKey != scripttemplate.ScriptKey && scripttemplate.CallerType != ReactorQualifer.Reactor)
                    {
                        LastKey = scripttemplate.ScriptKey;
                        scp.Reactor.Decorator = scp;
                        Scripts.Add(scp);
                    }
                    else
                    {
                        var post = ServerContext.GlobalReactorCache
                                   .FirstOrDefault(i => i.Value.ScriptKey == LastKey);

                        if (post.Value != null)
                        {
                            var ps     = ScriptManager.Load <ReactorScript>(post.Value.CallBackScriptKey, scp.Reactor);
                            var parent = Scripts.Find(i => i.Reactor.ScriptKey == scp.Reactor.CallingReactor);

                            if (parent != null)
                            {
                                scp.Reactor.Decorator = scp;

                                parent.Reactor.PostScript = ps;
                                Scripts.Add(scp);
                            }
                        }
                    }
                }
            }

            ServerContext.Info?.Info("[{0}] Reactor Scripts Loaded: {1}", Client.Aisling.Username, Scripts.Count);
        }
コード例 #7
0
ファイル: ReactorScript.cs プロジェクト: TopHatJoe/couchRogue
    private ReactorScript GetOriginReactor()
    {
        ReactorScript _reactScr = sysScr.GetOriginObj().GetComponent <ReactorScript> ();

        return(_reactScr);
    }