示例#1
0
        protected override void Awake()
        {
            base.Awake();
            rb               = GetComponent <Rigidbody2D>();
            turret           = transform.GetChild(0).gameObject; //assume turret is only child
            bulletSpawnPoint = turret.transform.GetChild(0);
            lr               = turret.GetComponent <LineRenderer>();

            HPChanged        = new UnityFloatEvent();
            ResourcesChanged = new UnityResourceTankEvent();

            // initialize tanks and set to 0
            ResourceTanks = new Dictionary <ResourceType, float>();
            foreach (ResourceType r in Enum.GetValues(typeof(ResourceType)))
            {
                ResourceTanks.Add(r, 6);
            }

            SystemGrid = new Dictionary <ResourceType, Dictionary <TankSystem, bool> >();
            foreach (ResourceType r in Enum.GetValues(typeof(ResourceType)))
            {
                SystemGrid.Add(r, new Dictionary <TankSystem, bool>());
                foreach (TankSystem sys in Enum.GetValues(typeof(TankSystem)))
                {
                    SystemGrid[r].Add(sys, false);
                }
            }
        }