Пример #1
0
    protected void tryQuest()
    {
        if (myQuests.checkQuest())
        {
            if (MetaScript.getRes().roomForResource(ResourceTypes.POPULATION, 1))
            {
                Debug.Log("QUEST COMPLETED");
                GetComponentInChildren <SpeechBubble>().setText("Quest Completed");

                MetaScript.Poof(transform.position);
                TakeSoul();
            }
            else
            {
                Debug.Log("Not enough population");
                GetComponentInChildren <SpeechBubble>().setText("You require additional Pylons... I mean houses");
            }
        }
        else
        {
            Debug.Log("Attempted quest but failed. Need " +
                      myQuests.GetQuestGoal().getThreshold() + " of " +
                      GetQuestType().Name
                      );


            gameObject.GetComponentInChildren <SpeechBubble>().setText("Need " +
                                                                       myQuests.GetQuestGoal().getThreshold() + " " +
                                                                       GetQuestType().Name);
        }
    }
Пример #2
0
        [HttpDelete("{server}/{database}/script/{uuid}")] public async Task <ActionResult> DeleteScript([FromRoute] Guid server, [FromRoute] Guid database, [FromRoute] Guid uuid)
        {
            DatabaseServer srv = Metadata.Servers.Where(s => s.Identity == server).FirstOrDefault();

            if (srv == null)
            {
                return(NotFound());
            }
            DatabaseInfo db = srv.Databases.Where(db => db.Identity == database).FirstOrDefault();

            if (db == null)
            {
                return(NotFound());
            }
            MetaScript existing = db.Scripts.Where(scr => scr.Identity == uuid).FirstOrDefault();

            if (existing == null)
            {
                return(NotFound());
            }

            string    catalogName = GetDatabaseCatalog(srv, db);
            string    scriptPath  = $"{catalogName}/{uuid.ToString().ToLower()}{SCRIPT_FILE_EXTENSION}";
            IFileInfo fileInfo    = FileProvider.GetFileInfo(scriptPath);

            System.IO.File.Delete(fileInfo.PhysicalPath);

            db.Scripts.Remove(existing);
            SaveMetadataSettings();

            return(Ok());
        }
Пример #3
0
 // Use this for initialization
 void Start()
 {
     for (int i = 0; i < (int)ResourceTypes.NumberOfTypes; i++)
     {
         MetaScript.getRes().increaseCapacity(i, maxAmount[i]);
     }
 }
Пример #4
0
 private void purchase()
 {
     for (int i = 0; i < upgradeCostList.Length - 1; i++)
     {
         MetaScript.getRes().addResource(i, -upgradeCostList [i]);
     }
 }
Пример #5
0
    void Start()
    {
        allUIObject = GameObject.Find("AllUIObjectsCanvas");

        buildingMenuObject = allUIObject.transform.GetChild(2).gameObject;
        controls           = MetaScript.GetControls();
    }
Пример #6
0
 public void purchase()
 {
     for (int i = 0; i < cost.Length; i++)
     {
         MetaScript.getRes().addResource(i, -cost [i]);
     }
 }
Пример #7
0
    // Update is called once per frame
    void Update()
    {
        Vector3 tPos = MetaScript.getPlayer().transform.position;
        Vector3 pPos = transform.position;

        navComponent.enabled = true;
        //navComponent.SetDestination(target.transform.position);
        float distanceToTarget = Vector3.SqrMagnitude(tPos - pPos);

        if (distanceToTarget <= Mathf.Pow(followDistance, 2))
        {
            navComponent.isStopped = true;
        }
        else if (distanceToTarget >= Mathf.Pow(maxDist, 2))
        {
            navComponent.enabled = false;
            Vector3 updatePos = (pPos - tPos).normalized * maxDist + tPos;
            updatePos.y          = tPos.y;
            transform.position   = updatePos;
            navComponent.enabled = true;
        }
        else
        {
            navComponent.isStopped = false;
            navComponent.SetDestination(tPos);
        }
    }
Пример #8
0
 // Update is called once per frame
 void Update()
 {
     if (controls.keyDown(controls.Outpost) && canSend && buildingPrefabs[0].GetComponent <resourceCost>().canAfford())
     {
         if (MetaScript.getOPController().checkDistance(transform.position))
         {
             if (MetaScript.getOPController().canAddOutPost())
             {
                 // Build surrounding area to avoid nav issues
                 MetaScript.getPlayer().GetComponent <DynamicGeneration>().generateSurrounding(Chunk.getChunkPos(transform.position));
                 canSend = false;
                 buildingPrefabs[0].GetComponent <resourceCost>().purchase();
                 Instantiate(buildingPrefabsObjects[0], gameObject.transform.position, Quaternion.identity);
                 StartCoroutine(canSendTimer());
                 MetaScript.getOPController().addOutpost();
             }
             else
             {
                 Debug.Log("Already at the outpost limit");
             }
         }
         else
         {
             Debug.Log("Campfire too close to other campfire or TC");
         }
     }
 }
Пример #9
0
    public static void Poof(Vector3 pos)
    {
        Vector3 poofPos = pos;

        poofPos.y = 0.3f;
        Instantiate(MetaScript.getMeta().PoofAnimation, poofPos, Quaternion.identity);
    }
Пример #10
0
 // Use this for initialization
 void Start()
 {
     player     = MetaScript.getPlayer();
     spawnPoint = gameObject;
     canFire    = true;
     controls   = MetaScript.GetControls();
 }
Пример #11
0
 // Update is called once per frame
 void Update()
 {
     if (player.GetComponent <Health>().getHealth() <= 0 && MetaScript.GetNPC().getCount() == 0)
     {
         gameEnds();
     }
 }
Пример #12
0
 //private GameObject cam;
 private void Awake()
 {
     animator = gameObject.GetComponentInChildren <Animator>();
     controls = MetaScript.GetControls();
     rpgtalk  = GameObject.FindObjectOfType <RPGTalk>();
     // cam = GameObject.Find("MainCam");
 }
Пример #13
0
    private void getDest()
    {
        if (opponent != null)
        {
            opponent.SendMessage("stopTargeted", gameObject);
        }

        opponent = collect.findClosestTag("OwnedNPC", gameObject);
        if (opponent != null)
        {
            float oppDist    = (transform.position - opponent.transform.position).sqrMagnitude;
            float playerDist = (transform.position - MetaScript.getPlayer().transform.position).sqrMagnitude;
            if (playerDist < oppDist)
            {
                opponent = MetaScript.getPlayer();
            }
        }
        else
        {
            opponent = MetaScript.getPlayer();
        }
        if (opponent != null)
        {
            opponent.SendMessage("beingTargeted", gameObject);
        }
    }
Пример #14
0
 // Update is called once per frame
 void Update()
 {
     if (player == null)
     {
         player = MetaScript.getPlayer();
         Debug.Log("Building had to find player again");
     }
 }
Пример #15
0
 public void recieveAction()
 {
     MetaScript.preTeleport();
     MetaScript.getPlayer().GetComponent <DynamicGeneration>().enabled = false;
     MetaScript.getPlayer().transform.position = new Vector3(entranceXPos, DEPTH, entranceZPos);
     MetaScript.getPlayer().GetComponent <InBuilding>().setPlayerInBuilding(true);
     MetaScript.postTeleport();
 }
Пример #16
0
    private void Start()
    {
        timer2 = timer;
        player = MetaScript.getPlayer();

        buildingCheck = player.GetComponent <InBuilding>();
        controls      = MetaScript.GetControls();
    }
Пример #17
0
 public void getDirection()
 {
     townCentre = MetaScript.getTownCenter();
     if (townCentre != null)
     {
         travelDirection = (townCentre.transform.position - transform.position).normalized;
     }
 }
Пример #18
0
    void OnDisable()
    {
        // Unload navmesh and clear handle
        m_Instance.Remove();

        // Notify the player that this navmesh doesn't need to be checked
        MetaScript.getPlayer().SendMessage("RemResMesh", this);
    }
Пример #19
0
 public void recieveAction()
 {
     for (int i = 0; i < amount.Length; i++)
     {
         MetaScript.getRes().addResource(i, amount[i]);
     }
     Destroy(gameObject);
 }
Пример #20
0
    private void drop()
    {
        float resMult = MetaScript.getGlobal_Stats().getGatherMultiplier();

        curRes = (int)((float)curRes * resMult);
        MetaScript.getRes().addResource(this.findingType, curRes);
        curRes = 0;
    }
Пример #21
0
 void publish()
 {
     foreach (IStatsListener l in subscribers)
     {
         l.publish(this);
     }
     MetaScript.updateGlobalStatsUI();
 }
Пример #22
0
 public void recieveAction()
 {
     MetaScript.getRes().addResource(myType, 1);
     SendMessage("damage", 1);
     if (hasSound)
     {
         GetComponent <AudioSource> ().Play();
     }
 }
Пример #23
0
 private static bool takeRes(ResourceTypes i, int a)
 {
     if (hasRes(i, a))
     {
         MetaScript.getRes().addResource(i, -a);
         return(true);
     }
     return(false);
 }
Пример #24
0
 void Start()
 {
     textsValuesText = new Text[(int)ResourceTypes.NumberOfTypes];
     for (int i = 0; i < (int)ResourceTypes.NumberOfTypes; i++)
     {
         textsValuesText [i] = this.transform.GetChild(i).GetChild(0).gameObject.GetComponent <Text> ();
     }
     resourceManager = MetaScript.getRes();
     updateResourcesUI();
 }
Пример #25
0
    public static void Tomb(Vector3 pos, string enslaved)
    {
        Vector3 tombPos = pos;

        tombPos.y = 0.1f;
        GameObject tomb = Instantiate(MetaScript.getMeta().Tombstone, tombPos, Quaternion.identity);

        tomb.GetComponent <Tomb>().setName(enslaved);
        MetaScript.getMeta().souls.AddLast(enslaved);
    }
Пример #26
0
 private void starving()
 {
     foreach (var aNPC in MetaScript.GetNPC().getNPCs().ToArray())
     {
         if (aNPC != null)
         {
             aNPC.GetComponent <Health> ().damage(damageForStarving);
         }
     }
 }
Пример #27
0
 protected override void slow(GameObject victim)
 {
     if (!MetaScript.getGlobal_Stats().getHasHeatProtection())
     {
         InBuilding shelterCheck = victim.GetComponent <InBuilding>();
         if (shelterCheck == null || !shelterCheck.getPlayerInBuilding())
         {
             buffsys.slowApplyingSystem(victim, slowDuration, slowDecimal);
         }
     }
 }
Пример #28
0
    void combat()
    {
        Debug.Log("Combat Entered");

        if (target != null)
        {
            animator.SetBool("attack", true);
            float damage = gameObject.GetComponent <Skills>().damage *MetaScript.getGlobal_Stats().getMilitaryAbility();
            target.GetComponent <Health>().damage(Mathf.RoundToInt(damage));
        }
    }
Пример #29
0
    void Start()
    {
        allUIObject = GameObject.Find("AllUIObjectsCanvas");

        npcManager = allUIObject.transform.GetChild(0).GetChild(0).gameObject;

        npcDisplay  = allUIObject.transform.GetChild(1).GetChild(0).gameObject;
        moreDetails = allUIObject.transform.GetChild(1).GetChild(1).gameObject;
        roleSelect  = allUIObject.transform.GetChild(1).GetChild(2).gameObject;
        controls    = MetaScript.GetControls();
    }
Пример #30
0
 // Update is called once per frame
 void Update()
 {
     if (inCombat && timeControl)
     {
         StartCoroutine(combatManager());
     }
     if (originalMultiplier < MetaScript.getGlobal_Stats().getAtkMultiplier())
     {
         originalMultiplier = MetaScript.getGlobal_Stats().getAtkMultiplier();
         damage             = Mathf.RoundToInt(baseDamage * originalMultiplier);
     }
 }