示例#1
0
    public void OnButtonEndLevelPressed()
    {
        WorldControl.GetInstance().EndLevel();

        DialogsController.GetInstance().ShowDialog(DialogType.StartMenu);
        SetActive(false);
    }
示例#2
0
    // Update is called once per frame
    void FixedUpdate()
    {
        TimeCoordinates[0, 0] = 1;
        WorldControlScript    = GameObject.Find("WorldController").GetComponent <WorldControl>();
        check = WorldControlScript.ZaWarudo1;
        Debug.DrawRay(transform.position, transform.forward * 10, Color.green);

        //int LayerMask = 1 << 11;
        RaycastHit hit;

        if (Physics.Raycast(transform.position, transform.forward, out hit, Mathf.Infinity))
        {
            if (hit.collider.tag == "Player")
            {
                if (activated == true)
                {
                    if (hit.collider.GetComponent <PlayerControll>().ZaWarudo != true || hit.collider.GetComponent <PlayerControll>().ZaWarudo != true)
                    {
                        {
                            Invoke("Fire", 0f);
                        }
                    }
                }
            }
        }
    }
示例#3
0
 private void OnDestroy()
 {
     if (m_instance == this)
     {
         m_instance = null;
     }
 }
示例#4
0
    private void OnKilled()
    {
        m_isAlive       = false;
        m_enableControl = false;
        HealthCurrent   = 0.0f;

        if (crashSound)
        {
            WorldControl.GetInstance().soundController.PlayShortSound(crashSound);
        }

        m_engineControl.SetEngineActive(false);

        if (destroyedRocketObject != null)
        {
            destroyedRocketObject.SetActive(true);
        }

        if (rocketObject != null)
        {
            rocketObject.SetActive(false);
        }

        WorldControl.GetInstance().ShowMessage("You broke you rocket. Try again.");
        StartCoroutine(RestartCrt());
    }
示例#5
0
 public WorldEditorScreen() : base()
 {
     control         = new WorldControl(this);
     control.Visible = true;
     Game.instance.IsMouseVisible = true;
     previousMouseState           = Mouse.GetState();
 }
示例#6
0
 void Start()
 {
     if (m_engineWorkingSound)
     {
         WorldControl.GetInstance().soundController.SetEngineAudioClip(m_engineWorkingSound);
     }
 }
 public void Win()
 {
     worldControl             = GameObject.Find("WorldControl").GetComponent <WorldControl>();
     black                    = GameObject.Find("BlackScreen");
     black.transform.position = new Vector3(0, 0, 0);
     worldControl.NextScene();
 }
示例#8
0
 public override void OnTriggered(RocketControl rocket)
 {
     if (WorldControl.GetInstance().getMap().GetComponent <MapInfo>().m_collectSound)
     {
         WorldControl.GetInstance().soundController.PlayShortSound(WorldControl.GetInstance().getMap().GetComponent <MapInfo>().m_collectSound);
     }
     Destroy(gameObject);
 }
示例#9
0
    private IEnumerator Play(NAnimation anim)
    {
        int frameIndex     = 0;
        int loopsRemaining = anim.loopCount;

        if (!anim.events.callStartEveryLoop)
        {
            anim.events.OnStart.Invoke();
        }

        while (anim.frames.Length > 0)
        {
            while (WorldControl.IsPaused)
            {
                yield return(null);
            }
            if (anim.events.callStartEveryLoop)
            {
                anim.events.OnStart.Invoke();
            }

            SetAnimSprite(anim.frames[frameIndex]);
            anim.CallEvents(frameIndex);

            yield return(StartCoroutine(WorldControl.PauseableWait(1f / anim.framerate)));

            if (frameIndex == anim.frames.Length - 1)               // end of the animation?
            {
                if (anim.events.callFinishEveryLoop)
                {
                    anim.events.OnFinish.Invoke();
                }

                if (!anim.lööp || loopsRemaining <= 0 && anim.loopCount != 0)
                {
                    break;
                }
                else if (anim.loopCount != 0)
                {
                    loopsRemaining--;
                }
            }
            frameIndex = (frameIndex + 1) % anim.frames.Length;
        }

        if (!anim.events.callFinishEveryLoop)
        {
            anim.events.OnFinish.Invoke();
        }

        currentAnimPlaying = null;
        if (anim.nextAnim != "")
        {
            PlayAnim(anim.nextAnim);
        }
    }
示例#10
0
    public void ApplyDamage(float damageAmount)
    {
        HealthCurrent -= damageAmount;
        WorldControl.GetInstance().CallHpChanged(HealthCurrent);

        if (HealthCurrent <= 0)
        {
            OnKilled();
        }
    }
    public void OnButtonStartPressed()
    {
        if (WorldControl.GetInstance() == null)
        {
            return;
        }

        WorldControl.GetInstance().LoadLevel(m_mapIdx);
        SetActive(false);
    }
示例#12
0
    public override void OnTrigerStay(RocketControl rocket)
    {
        if (m_idx == WorldControl.GetInstance().CurrentCheckpoint || m_allowedVelosity < rocket.GetComponent <Rigidbody2D>().velocity.magnitude)
        {
            return;
        }

        WorldControl.GetInstance().OnCheckpointSaved(m_idx);
        WorldControl.GetInstance().ShowMessage("Checkpoint saved!");
    }
示例#13
0
    public static void Clear()
    {
        PlayerPrefs.DeleteAll();
        Init();
        WorldControl wc = WorldControl.GetInstance();

        if (wc != null)
        {
            wc.Init();
        }
    }
示例#14
0
    private void Start()
    {
        WorldControl.GetInstance().OnHPChanged     += OnValueChanged;
        WorldControl.GetInstance().OnRocketCreated += OnRocketCreated;

        var rocket = WorldControl.GetInstance().GetRocketControl();

        if (rocket)
        {
            OnRocketCreated(rocket);
        }
    }
示例#15
0
    private void Awake()
    {
        if (m_instance != null)
        {
            Debug.Assert(m_instance == this, "Second DialogsController insance");
            return;
        }

        m_instance      = this;
        MapList         = GetComponent <MapList>();
        RocketList      = GetComponent <RocketList>();
        soundController = GetComponent <SoundController>();
    }
示例#16
0
    override public void OnEngineStart()
    {
        ParticleSystem particleSystem = GetComponent <ParticleSystem>();

        if (particleSystem != null)
        {
            particleSystem.Play();
        }
        transform.parent.GetComponent <Rigidbody2D>().AddForce((Vector2)transform.parent.up * m_power * Time.deltaTime);
        if (m_engineStartSound)
        {
            WorldControl.GetInstance().soundController.PlayShortSound(m_engineStartSound);
        }
    }
示例#17
0
    void Awake()
    {
        WorldControl.NPCID = 0;

        if (instance != null)
        {
            Destroy(this.gameObject);
            return;
        }
        else
        {
            instance = this;
            GameObject.DontDestroyOnLoad(this.gameObject);
        }
    }
示例#18
0
    public void Activate()
    {
        if (m_state != State.Inactive)
        {
            return;
        }

        m_state = State.Active;
        if (m_particleSystem)
        {
            m_particleSystem.Play();
        }

        WorldControl.GetInstance().ShowMessage("Checkpoint activated!");
    }
示例#19
0
    public bool InitWithMapIdx(int mapIdx)
    {
        m_mapIdx = mapIdx;
        var mapPaths = WorldControl.GetInstance().MapList.GetMapPaths(mapIdx);

        if (mapPaths == null)
        {
            m_textMapName.text = $"MISSING {mapIdx}";
            SetIconSprite(MapsHelper.GetDefaultIcon());
            return(false);
        }

        m_textMapName.text = mapPaths.Name;
        SetIconSprite(mapPaths.GetMapIcon());
        return(true);
    }
示例#20
0
    // Update is called once per frame
    void FixedUpdate()
    {
        rb.velocity           = transform.TransformDirection(Vector3.forward * 10);
        WorldControlScript    = GameObject.Find("WorldController").GetComponent <WorldControl>();
        PlayerControllScript1 = GameObject.Find("PlayerCube1").GetComponent <PlayerControll>();
        PlayerControllScript2 = GameObject.Find("PlayerCube2").GetComponent <PlayerControll2>();
        if (PlayerControllScript1.ZaWarudo == true || PlayerControllScript2.ZaWarudo == true)
        {
            rb.velocity = rb.velocity * 0;
        }

        distanceMoved += Vector3.Distance(transform.position, startPosition);
        if (distanceMoved > 50000f)
        {
            Invoke("Destroy", 0);
        }
    }
示例#21
0
    private void Update()
    {
        if (!m_enableControl || !WorldControl.GetInstance().IsInGame || WorldControl.GetInstance().IsPaused)
        {
            return;
        }

        var isEngine = Input.GetButton("Jump");

        m_engineControl.SetEngineActive(isEngine);

        float rotation = Input.GetAxis("Horizontal");

        if (rotation != 0)
        {
            var sign = rotation > 0 ? -1 : 1;
            transform.Rotate(0, 0, sign * Time.deltaTime * (1 + m_agility / GetComponent <Rigidbody2D>().angularDrag), Space.Self);
        }
    }
示例#22
0
    public void Reset()
    {
        m_isAlive       = true;
        m_enableControl = true;
        HealthCurrent   = m_durability;
        WorldControl.GetInstance().CallHpChanged(HealthCurrent);

        if (rocketObject)
        {
            rocketObject.SetActive(true);
        }

        if (destroyedRocketObject)
        {
            destroyedRocketObject.SetActive(false);
        }

        m_engineControl.SetEngineActive(false);
    }
示例#23
0
    public virtual void OnEngineStop()
    {
        ParticleSystem particleSystem = GetComponent <ParticleSystem>();

        if (particleSystem)
        {
            particleSystem.Stop();
        }

        if (m_engineStopSound)
        {
            WorldControl.GetInstance().soundController.PlayShortSound(m_engineStopSound);
        }

        if (m_engineWorkingSound)
        {
            WorldControl.GetInstance().soundController.StopEngineSound();
        }
    }
示例#24
0
    private void UpdateScrollContent()
    {
        ClearScroll();

        var mapList = WorldControl.GetInstance().MapList;

        for (var i = 0; i < mapList.Count; ++i)
        {
            var itemController = Instantiate(m_mapItemPrefab, m_scroll.content);
            if (itemController.InitWithMapIdx(i))
            {
                itemController.OnPressed += OnMapSelected;
            }
            else
            {
                Destroy(itemController.gameObject);
            }
        }
    }
示例#25
0
    // Use this for initialization
    void Start()
    {
        theWorld = FindObjectOfType <WorldControl>();

        if (theWorld)
        {
            print("found the world");
        }
        else
        {
            print("No world");
        }
        eggs    = new List <EggControl>();
        items   = new List <PickUpItemControl>();
        enemies = new List <NPCControl>();
        player  = new List <PenguinControl>();

        LevelControl();
    }
    public void SetMapIdx(int mapIdx)
    {
        m_mapIdx = mapIdx;

        var mapPaths = WorldControl.GetInstance().MapList.GetMapPaths(mapIdx);

        if (mapPaths == null)
        {
            SetActive(false);
            return;
        }

        var mapInfo = Resources.Load <MapInfo>(mapPaths.PrefabPath);

        m_imageIcon.sprite        = mapInfo.m_mapIcon;
        m_imageMiniMap.sprite     = mapInfo.m_miniImage;
        m_textMapName.text        = mapInfo.m_mapName;
        m_textMapDescription.text = mapInfo.m_mapDiscription;
        m_textMapGravity.text     = string.Format(m_stringGravity, mapInfo.m_mapGravity);
        m_textMapDrag.text        = string.Format(m_stringDrag, mapInfo.m_mapDrag);
        m_textMapFriction.text    = string.Format(m_strinFriction, mapInfo.m_mapFriction);
        m_textMapBounciness.text  = string.Format(m_strinBounciness, mapInfo.m_mapBounciness);
    }
示例#27
0
    public override void OnTrigerStay(RocketControl rocket)
    {
        if (m_state != State.Timer)
        {
            return;
        }

        m_timeLeft -= Time.deltaTime;
        if (m_timeLeft <= 0)
        {
            m_state = State.Checked;
            if (m_particleSystem)
            {
                m_particleSystem.Stop();
            }
            m_collider.enabled = false;
            WorldControl.GetInstance().ShowMessage("Checkpoint collected!");
            WorldControl.GetInstance().OnTargetZoneChecked();
        }
        else
        {
            WorldControl.GetInstance().ShowMessage("Checkpoint will be collected in (" + string.Format("{0:0.00}", Mathf.Round(m_timeLeft * 100.0f) / 100.0f) + ")");
        }
    }
示例#28
0
 void Awake()
 {
     _ins = this;
 }
示例#29
0
    void Start()
    {
        if(Instance == null) {

            Instance = this;
        }

        world = new World(100, 100);
        createCellGOs();
    }
 public void Start()
 {
     state = GameObject.Find("WorldState").GetComponent<WorldState>();
     animator = GetComponentInChildren<Animator>();
     wc = GameObject.Find("WorldState").GetComponent<WorldControl>();
 }
示例#31
0
 /// <summary>
 /// Must be called by the world on create to do the callback for onPush
 /// </summary>
 /// <param name="worldControl">Pointer to the world</param>
 internal void ThisIsMe(WorldControl worldControl)
 {
     world = worldControl;
 }
示例#32
0
 // Use this for initialization
 void Start()
 {
     world = (WorldControl)GameObject.Find("world_control").GetComponent<WorldControl>();
     database = world.item_database;
     for(int i=0; i < (slots_x*slots_y); i++)
     {
         slots.Add(new Item());
         inventory.Add(new Item());
     }
 }
示例#33
0
    private IEnumerator RestartCrt()
    {
        yield return(new WaitForSeconds(2));

        WorldControl.GetInstance().RestartFromCheckpoint();
    }
示例#34
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            WindowPosition.Move(this);

            _windowState = this.WindowState;

            Thread.CurrentThread.Priority = ThreadPriority.Highest;

            TopRelativeDoubleConverter.GetDoubleEvent = (object state) =>
            {
                return this.PointToScreen(new Point(0, 0)).Y;
            };

            LeftRelativeDoubleConverter.GetDoubleEvent = (object state) =>
            {
                return this.PointToScreen(new Point(0, 0)).X;
            };

            WorldControl worldControl = new WorldControl(_outoposManager, _bufferManager);
            worldControl.Height = Double.NaN;
            worldControl.Width = Double.NaN;
            _worldContentControl.Content = worldControl;

            ChatControl chatControl = new ChatControl(_outoposManager, _bufferManager);
            chatControl.Height = Double.NaN;
            chatControl.Width = Double.NaN;
            _chatContentControl.Content = chatControl;

            if (Settings.Instance.Global_Update_Option == UpdateOption.AutoCheck
               || Settings.Instance.Global_Update_Option == UpdateOption.AutoUpdate)
            {
                this.CheckUpdate(false);
            }

            this.SetConnectionState(ConnectionState.Red);

            this.GarbageCollect();
        }