public override void OnVisionHasChanged(VisionType vt)
    {
        bool current = spawningVision == vt.CurrentVision;

        //if (current != previous)
        //{
        //    previous = current;
        //    foreach (Transform child in _childs)
        //        child.SendMessage(spawningVision == vt.CurrentVision ? "Pop" : "Depop");
        //}
        //else
        //{

        //}

        foreach (Collider c in _cols)
        {
            c.enabled = current;
        }

        foreach (Renderer r in _rds)
        {
            r.enabled = current;
        }
    }
Пример #2
0
    public override void OnInspectorGUI()
    {
        EditorGUILayout.Space();
        currentVision = (VisionType)EditorGUILayout.EnumPopup("View: ", currentVision);
        EditorGUILayout.Space();
        switch (currentVision)
        {
        case VisionType.Standard:
        {
            base.OnInspectorGUI();
            if (GUILayout.Button("Rebuild Grid"))
            {
                builder.Grid.RebuildGridComponent();
            }
            break;
        }

        case VisionType.TowerList:
        {
            InspectorUtils.ShowTowerList(builder.TowersToBuild);
            break;
        }
        }
        EditorGUILayout.Space();
    }
Пример #3
0
    private Enemy SpawnEnemy(EnemyType _enemyType, VisionType _visionType, float dist, float degrees)
    {
        Enemy temp = null;

        switch (_enemyType)
        {
        case EnemyType.Skull:
            temp = Instantiate(Skull);
            break;

        case EnemyType.Drone:
            temp = Instantiate(Drone);
            break;

        case EnemyType.Golem:
            temp = Instantiate(Golem);
            break;

        default:
            Debug.LogError("Invalid Enemy Type of " + _enemyType);
            return(null);
        }
        float rad = degrees * Mathf.Deg2Rad;

        temp.transform.position = new Vector3(Mathf.Sin(rad) * dist, _enemyType == EnemyType.Drone ? 5 : 0, Mathf.Cos(rad) * dist);
        temp.ChangeColor(_visionType);
        enemies.Add(temp.gameObject);
        return(temp);
    }
Пример #4
0
    IEnumerator CrystalCoroutine(int balNum)
    {
        Renderer r;
        int      prevHP;

        coll.enabled = false;

        yield return(new WaitForSeconds(2f));

        while (currHP > 0)
        {
            currentColor = (VisionType)Random.Range(1, 4);
            r            = cover.GetComponent <Renderer>();
            r.material.SetInt("_MaskType", 0);
            r.material.SetColor("_Color", Constants.Vision_Color(currentColor));
            r.material.SetInt("_StencilComp", 0);

            cover.transform.localScale = Vector3.zero;
            cover.SetActive(true);

            for (float timer = 0; timer <= 0.5f; timer += Time.deltaTime)
            {
                cover.transform.localScale = new Vector3(coverScale.x * timer / 0.5f, coverScale.y * timer / 0.5f, coverScale.z);
                yield return(null);
            }
            cover.transform.localScale = coverScale;
            balloons = new List <Balloon>();

            for (int i = 0; i < balNum; i++)
            {
                Balloon b    = new Balloon(spherePrefab, linePrefab, this);
                float   rad  = (Random.Range(0, 2) == 0 ? Random.Range(-90f, -20f) : Random.Range(20f, 90f)) * Mathf.PI / 180f;
                float   dist = Random.Range(6, 19);
                b.sphere.transform.position = new Vector3(Mathf.Sin(rad) * dist, Random.Range(5, 8), Mathf.Cos(rad) * dist);
                b.ChangeColor(currentColor);
                balloons.Add(b);
            }

            while (balloons.Count > 0)
            {
                yield return(null);
            }

            for (float timer = 0; timer <= 0.5f; timer += Time.deltaTime)
            {
                cover.transform.localScale = new Vector3(coverScale.x * (0.5f - timer) / 0.5f, coverScale.y * (0.5f - timer) / 0.5f, coverScale.z);
                yield return(null);
            }
            cover.SetActive(false);
            coll.enabled = true;
            prevHP       = currHP;

            for (float timer = 0; timer <= 9 - balNum * 2; timer += Time.deltaTime)
            {
                //if (prevHP - currHP >= maxHP / 2 + 1 || currHP <= 0) break;
                yield return(null);
            }
            coll.enabled = false;
        }
    }
Пример #5
0
    private Panel SpawnPanel(PanelType _panelType, VisionType _visionType)
    {
        Panel temp = null;

        switch (_panelType)
        {
        case PanelType.Normal:
            temp = Instantiate(Normal);
            break;

        case PanelType.Long:
            temp = Instantiate(Long);
            break;

        default:
            Debug.LogError("Invalid Enemy Type of " + _panelType);
            return(null);
        }
        toolSpawnBox.position   = new Vector3(player.position.x, toolSpawnBox.position.y, player.position.z + 0.3f);
        temp.transform.position = new Vector3(
            Random.Range(toolSpawnBox.position.x - toolSpawnBox.localScale.x / 2, toolSpawnBox.position.x + toolSpawnBox.localScale.x / 2),
            Random.Range(toolSpawnBox.position.y - toolSpawnBox.localScale.y / 2, toolSpawnBox.position.y + toolSpawnBox.localScale.y / 2),
            Random.Range(toolSpawnBox.position.z - toolSpawnBox.localScale.z / 2, toolSpawnBox.position.z + toolSpawnBox.localScale.z / 2));
        temp.ChangeColor(_visionType);
        return(temp);
    }
Пример #6
0
    public virtual void ChangeColor(VisionType _visionType)
    {
        foreach (Renderer r in GetComponentsInChildren <Renderer>())
        {
            r.material.SetInt("_MaskType", (int)_visionType);
            r.material.SetColor("_Color", Constants.Vision_Color(_visionType));
            if (_visionType == VisionType.White)
            {
                r.material.SetInt("_StencilComp", 0);
            }
            if (r.gameObject.tag.Contains("HeartFill"))
            {
                r.material.SetColor("_Color", new Color(1, 0f, 0.8f));
            }
        }
        visionType = _visionType;
        switch (_visionType)
        {
        case VisionType.Red: Illuminate(); break;

        case VisionType.Green: vibrationCoroutine = StartCoroutine(Vibrate()); break;

        case VisionType.Blue: Roar(); break;

        default: break;
        }
    }
Пример #7
0
        /// <summary>
        /// Create a new entity, naked and squirming
        /// Created with no equipment, knowledge, family, etc
        /// </summary>
        /// <param name="template"></param>
        /// <param name="needs"></param>
        /// <param name="level"></param>
        /// <param name="job"></param>
        /// <param name="sex"></param>
        /// <param name="sexuality"></param>
        /// <param name="position"></param>
        /// <param name="icons"></param>
        /// <param name="world"></param>
        public Entity(EntityTemplate template, Dictionary <NeedIndex, EntityNeed> needs, int level, JobType job, Sex sex, Sexuality sexuality,
                      Vector2Int position, List <Sprite> sprites, WorldInstance world) :
            base(NameProvider.GetRandomName(template.CreatureType, sex), template.Statistics[StatisticIndex.Endurance].Value * 2, position, sprites, template.JoyType, true)
        {
            this.CreatureType = template.CreatureType;

            this.m_Size = template.Size;
            this.Slots  = template.Slots;

            this.m_JobLevels       = new Dictionary <string, int>();
            this.m_Sexuality       = sexuality;
            this.m_IdentifiedItems = new List <string>();
            this.m_Statistics      = template.Statistics;

            if (template.Skills.Count == 0)
            {
                this.m_Skills = EntitySkillHandler.GetSkillBlock(needs);
            }
            else
            {
                this.m_Skills = template.Skills;
            }
            this.m_Needs     = needs;
            this.m_Abilities = template.Abilities;
            this.m_Level     = level;
            for (int i = 1; i < level; i++)
            {
                this.LevelUp();
            }
            this.m_Experience     = 0;
            this.m_CurrentJob     = job;
            this.m_Sentient       = template.Sentient;
            this.m_NaturalWeapons = NaturalWeaponHelper.MakeNaturalWeapon(template.Size);
            this.m_Equipment      = new Dictionary <string, ItemInstance>();
            this.m_Backpack       = new List <ItemInstance>();
            this.m_Relationships  = new Dictionary <long, int>();
            this.Sex          = sex;
            this.m_Family     = new Dictionary <long, RelationshipStatus>();
            this.m_VisionType = template.VisionType;

            this.m_Tileset = template.Tileset;

            this.CalculateDerivatives();

            this.m_Vision = new bool[1, 1];

            this.m_Pathfinder      = new Pathfinder();
            this.m_PathfindingData = new Queue <Vector2Int>();

            this.m_FulfillingNeed    = (NeedIndex)(-1);
            this.m_FulfilmentCounter = 0;

            this.RegenTicker = RNG.Roll(0, REGEN_TICK_TIME - 1);

            this.MyWorld = world;

            SetFOVHandler();
            SetCurrentTarget();
        }
Пример #8
0
    public void SetColor(VisionType visionType)
    {
        ParticleSystemRenderer r = GetComponent <ParticleSystemRenderer>();

        r.material.SetInt("_MaskType", 0);
        r.material.SetColor("_Color", Constants.Vision_Color(visionType));
        r.material.SetInt("_StencilComp", 0);
    }
Пример #9
0
 public void ChangeColor(VisionType _visionType)
 {
     foreach (Renderer r in frameRenderers)
     {
         r.material.SetColor("_Color", Constants.Vision_Color(_visionType));
     }
     panelRenderer.material.SetInt("_MaskType", (int)_visionType);
     panelRenderer.material.renderQueue = 1950 + (int)_visionType;
     visionType = _visionType;
 }
Пример #10
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            // Perform any additional setup after loading the view, typically from a nib.

            standardUserDefaults = NSUserDefaults.StandardUserDefaults;

            selectedType   = (VisionType)(int)standardUserDefaults.IntForKey(nameof(VisionType));
            selectedScript = (TextRecognitionScript)(int)standardUserDefaults.IntForKey(nameof(TextRecognitionScript));

            SettingsTable.ReloadSections(NSIndexSet.FromNSRange(new NSRange(0, 2)), UITableViewRowAnimation.Automatic);
        }
Пример #11
0
        public void ChangeColor(VisionType _visionType)
        {
            visionType = _visionType;
            Renderer r = sphere.GetComponent <Renderer>();

            r.material.SetInt("_MaskType", (int)visionType);
            r.material.SetColor("_Color", Constants.Vision_Color(visionType));
            r.material.SetInt("_StencilComp", 3);

            r = line.GetComponent <LineRenderer>();
            r.material.SetInt("_MaskType", (int)visionType);
            r.material.SetColor("_Color", Constants.Vision_Color(visionType));
            r.material.SetInt("_StencilComp", 3);

            sphere.GetComponent <Renderer>().enabled   = true;
            line.GetComponent <LineRenderer>().enabled = true;
        }
Пример #12
0
        public string GetCurrentCorrectionFromWhen(VisionType visionType, int cardId)
        {
            return("");

            /*
             * using (var session = Hibernate.SessionFactory.OpenSession())
             * {
             *  Card c = null;
             *
             *  return session.QueryOver(() => c)
             *      .Where(() => c.Id == cardId)
             *      .SelectList(l => l
             *          .Select(Pro.Conditional(
             *              Res.Eq(Pro.Constant((int)visionType), Pro.Constant(1)), Pro.Property("GLCurrentCorrectionFromWhen"), Pro.Property("CLCurrentCorrectionFromWhen"))))
             *      .SingleOrDefault<string>();
             * }
             */
        }
Пример #13
0
        public EntityTemplate(Dictionary <StatisticIndex, EntityStatistic> statistics, Dictionary <string, EntitySkill> skills, List <Ability> abilities, List <string> slots,
                              int size, bool sentient, VisionType visionType, string creatureType, string type, string tileset)
        {
            m_Statistics = statistics;
            m_Skills     = skills;
            m_Abilities  = abilities;
            m_Slots      = slots;

            m_Size = size;

            m_Sentient = sentient;

            m_VisionType = visionType;

            m_CreatureType = creatureType;
            m_Type         = type;

            m_Tileset = tileset;
        }
Пример #14
0
 public VisionSummonedEventArgs(VisionType vision)
 {
     Vision = vision;
 }
Пример #15
0
 public abstract void OnVisionHasChanged(VisionType vt);
Пример #16
0
 public override void OnVisionHasChanged(VisionType vt)
 {
     StopAllCoroutines();
     StartCoroutine("ChangeColor", _colors[(int)vt.CurrentVision]);
 }
Пример #17
0
 void Start()
 {
     vType = VisionType.Mono;
 }
Пример #18
0
        public static IEnumerable <StatDrawEntry> Postfix(
            IEnumerable <StatDrawEntry> statdrawentries,
            HediffDef __instance
            )
        {
            List <StatDrawEntry> statDrawEntryList = statdrawentries.ToList();

            foreach (StatDrawEntry sDE in statDrawEntryList)
            {
                yield return(sDE);
            }

            if (!Settings.Store.HediffLightMods.TryGetValue(__instance, out Hediff_LightModifiers hlm) ||
                !hlm.HasAnyModifier())
            {
                yield break;
            }

            VisionType vt = hlm.Setting;

            if (vt < VisionType.NVCustom)
            {
#if RW10
                yield return(new StatDrawEntry(
                                 Defs_Rimworld.BasicStats,
                                 "NVGrantsVisionType".Translate(),
                                 vt.ToString().Translate(),
                                 0,
                                 hlm.AffectsEye ? "NVHediffQualifier".Translate() : ""
                                 ));
#else
                yield return(new StatDrawEntry(
                                 Defs_Rimworld.BasicStats,
                                 "NVGrantsVisionType".Translate().RawText,
                                 vt.ToString().Translate().RawText,

                                 hlm.AffectsEye ? "NVHediffQualifier".Translate().RawText : "",
                                 0
                                 ));
#endif
            }
            else
            {
#if RW10
                yield return(new StatDrawEntry(
                                 Defs_Rimworld.BasicStats,
                                 "NVGrantsVisionType".Translate(),
                                 vt.ToString(),
                                 0,
                                 hlm.AffectsEye ? "NVHediffQualifier".Translate(): ""
                                 ));
#else
                yield return(new StatDrawEntry(
                                 Defs_Rimworld.BasicStats,
                                 "NVGrantsVisionType".Translate().RawText,
                                 vt.ToString(),
                                 hlm.AffectsEye ? "NVHediffQualifier".Translate().RawText: "",
                                 0
                                 ));
#endif

                yield return(new StatDrawEntry(
                                 Defs_Rimworld.BasicStats,
                                 Defs_NightVision.NightVision,
                                 hlm[0],
                                 StatRequest.ForEmpty(),
                                 ToStringNumberSense.Offset
                                 ));

                yield return(new StatDrawEntry(
                                 Defs_Rimworld.BasicStats,
                                 Defs_NightVision.LightSensitivity,
                                 hlm[1],
                                 StatRequest.ForEmpty(),
                                 ToStringNumberSense.Offset
                                 ));
            }
        }
Пример #19
0
 void GetSelectedUserData()
 {
     currentVisionType     = (VisionType)(int)NSUserDefaults.StandardUserDefaults.IntForKey(nameof(VisionType));
     currentTxtRecogScript = (TextRecognitionScript)(int)NSUserDefaults.StandardUserDefaults.IntForKey(nameof(TextRecognitionScript));
 }
Пример #20
0
 public VisionType UpgradeVision(VisionType type)
 {
     type++;
     return(type);
 }
Пример #21
0
    IEnumerator Stage()
    {
        List <VisionType> enableType  = new List <VisionType>();
        List <VisionType> disableType = new List <VisionType>();
        List <PanelType>  panelCand   = new List <PanelType>();

        enableType.Add(VisionType.White);
        disableType.Add(VisionType.Red);
        disableType.Add(VisionType.Green);
        disableType.Add(VisionType.Blue);

        panelCand.Add(PanelType.Long);
        panelCand.Add(PanelType.Normal);
        panelCand.Add(PanelType.Normal);

        int   stage     = 0;
        float delay     = initialDelay;
        float nextDelay = 0;
        int   enemyNum  = initialEnemy;
        float angle     = initialAngle;

        //fortest

        //스테이지 0 안내
        StartCoroutine(StageTextShow("Stage 0"));
        yield return(new WaitForSeconds(5f));

        while (true)
        {
            for (int i = 0; i < enemyNum; ++i)
            {
                SpawnEnemy((EnemyType)Random.Range(0, 3), enableType[Random.Range(0, enableType.Count)], enemySpawnDist, Random.Range(-angle, angle));
                if (nextDelay >= delay)
                {
                    yield return(new WaitForSeconds(delay + nextDelay));

                    nextDelay = 0;
                }
                else
                {
                    float tDelay = Random.Range(0, delay + nextDelay);
                    nextDelay = delay + nextDelay - tDelay;
                    delay     = Mathf.Max(delay - delayDec, delayMin);
                    yield return(new WaitForSeconds(tDelay));
                }
            }
            while (enemies.Count > 0)
            {
                yield return(null);
            }
            ++stage;
            if (stage >= 5)
            {
                break;
            }

            enemyNum += enemyIncByStage;
            delay     = Mathf.Max(initialDelay - delayDecByStage * stage, delayMin);
            angle     = Mathf.Min(angle + angleIncByStage, angleMax);
            if (disableType.Count > 0)
            {
                VisionType newVision = disableType[Random.Range(0, disableType.Count)];
                disableType.Remove(newVision);
                enableType.Add(newVision);

                int pTmp = Random.Range(0, panelCand.Count);
                SpawnPanel(panelCand[pTmp], newVision);
                panelCand.RemoveAt(pTmp);
            }
            StartCoroutine(StageTextShow("Stage " + stage));
            yield return(new WaitForSeconds(6f));
        }
        StartCoroutine(StageTextShow("Boss Stage"));
        yield return(new WaitForSeconds(6f));

        enemies.Add(Instantiate(BossBody).gameObject);
    }
Пример #22
0
        public void LoadFromXML(string path)
        {
            XmlSerializer reader = new XmlSerializer(typeof(PlayerRace));
            StreamReader file = new StreamReader(@path);
            var newRace = (PlayerRace)reader.Deserialize(file);

            this.AbilityScoreBuffs = newRace.AbilityScoreBuffs;
            this.Description = newRace.Description;
            this.LanguagesKnown = newRace.LanguagesKnown;
            this.MaxHeightinInches = newRace.MaxHeightinInches;
            this.MaxWeightinPounds = newRace.MaxWeightinPounds;
            this.MinHeightinInches = newRace.MinHeightinInches;
            this.MinWeightinPounds = newRace.MinWeightinPounds;
            this.Name = newRace.Name;
            this.Size = newRace.Size;
            this.SkillBuffs = newRace.SkillBuffs;
            this.SpeedInSquares = newRace.SpeedInSquares;
            this.Vision = newRace.Vision;
        }