Inheritance: MonoBehaviour
    void Solver_OnCollision(object sender, Obi.ObiSolver.ObiCollisionEventArgs e)
    {
        Oni.Contact[] contacts = e.contacts.Data;
        for (int i = 0; i < e.contacts.Count; ++i)
        {
            Oni.Contact c = contacts[i];
            // make sure this is an actual contact:
            if (c.distance < 0.01f)
            {
                // get the collider:
                Collider collider = ObiCollider.idToCollider[c.other] as Collider;

                if (collider != null)
                {
                    // make it blink:
                    Blinker blinker = collider.GetComponent <Blinker>();

                    if (blinker)
                    {
                        blinker.Blink();
                    }
                }
            }
        }
    }
    // Use this for initialization
    void Start()
    {
        blinker = new Blinker();
        blinker.reset();

        characterrenderer = gameObject.GetComponent <SkinnedMeshRenderer> ();
    }
    /// <summary>
    /// ダウンのシーケンスを作成
    /// </summary>
    /// <param name="monster"></param>
    /// <returns></returns>
    private Sequence CreateDownSequence(BattleMapMonster monster)
    {
        Sequence seq = DOTween.Sequence();

        // 点滅
        SpriteRenderer sr = monster.GameObject.GetComponent <SpriteRenderer>();

        Blinker blinker = new Blinker(sr);
        Tween   tween   = DOTween.To(() => blinker.Blink, (x) => blinker.Blink = x, 4, bc.GetBaseDuration() * 2);

        tween.SetEase(Ease.Linear);

        // エフェクト
        GameObject     effectGo = bc.particleSystemPrefabHolder.Instantiate(EffectType.EXTINCT044, monster.GameObject);
        ParticleSystem effectPs = effectGo.GetComponent <ParticleSystem>();

        // エフェクトの位置
        effectPs.transform.position = monster.GameObject.transform.position;

        tween.OnComplete(() =>
        {
            effectPs.Play();
            bc.monsterGenerator.DownMonster(monster);
        });

        seq.Append(tween);

        return(seq);
    }
    void Solver_OnCollision(object sender, Obi.ObiSolver.ObiCollisionEventArgs e)
    {
        var colliderWorld = ObiColliderWorld.GetInstance();

        Oni.Contact[] contacts = e.contacts.Data;
        for (int i = 0; i < e.contacts.Count; ++i)
        {
            Oni.Contact c = contacts[i];
            // make sure this is an actual contact:
            if (c.distance < 0.01f)
            {
                // get the collider:
                var col = colliderWorld.colliderHandles[c.other].owner;

                if (col != null)
                {
                    // make it blink:
                    Blinker blinker = col.GetComponent <Blinker>();

                    if (blinker)
                    {
                        blinker.Blink();
                    }
                }
            }
        }
    }
Beispiel #5
0
    void Start()
    {
        MusicTimer.OnWhole     += OnWhole;
        MusicTimer.OnHalf      += OnHalf;
        MusicTimer.OnQuarter   += OnQuarter;
        MusicTimer.OnEighth    += OnEighth;
        MusicTimer.OnSixteenth += OnSixteenth;

        MusicTimer timer     = GameObject.FindObjectOfType <MusicTimer>();
        float      barLength = timer.barLength;

        whole          = Instantiate <Blinker>(dotPrefab, new Vector3(-8, 0, 0), Quaternion.identity);
        whole.fadeTime = barLength;

        for (int i = 0; i < 16; i++)
        {
            if (i % 8 == 0)
            {
                halves[i / 8]          = Instantiate <Blinker>(dotPrefab, new Vector3(-8 + i, -1, 0), Quaternion.identity);
                halves[i / 8].fadeTime = barLength / 2;
            }
            if (i % 4 == 0)
            {
                quarters[i / 4]          = Instantiate <Blinker>(dotPrefab, new Vector3(-8 + i, -2, 0), Quaternion.identity);
                quarters[i / 4].fadeTime = barLength / 4;
            }
            if (i % 2 == 0)
            {
                eighths[i / 2]          = Instantiate <Blinker>(dotPrefab, new Vector3(-8 + i, -3, 0), Quaternion.identity);
                eighths[i / 2].fadeTime = barLength / 8;
            }
            sixteenths[i]          = Instantiate <Blinker>(dotPrefab, new Vector3(-8 + i, -4, 0), Quaternion.identity);
            sixteenths[i].fadeTime = barLength / 16;
        }
    }
Beispiel #6
0
    void Solver_OnCollision(object sender, Obi.ObiSolver.ObiCollisionEventArgs e)
    {
        if (solver.colliderGroup == null)
        {
            return;
        }

        foreach (Oni.Contact c in e.contacts)
        {
            // make sure this is an actual contact:
            if (c.distance < 0.01f)
            {
                // get the collider:
                Collider collider = solver.colliderGroup.colliders[c.other];

                // make it blink:
                Blinker blinker = collider.GetComponent <Blinker>();

                if (blinker)
                {
                    blinker.Blink();
                }
            }
        }
    }
 // Use this for initialization
 void Start()
 {
     charaTransform = character2P.transform.position;
     blin           = GetComponent <Blinker>();
     player         = GamePad.Index.Two;
     bulletHold2P   = bullet;
 }
Beispiel #8
0
            public Loaded(RuntimeGltfInstance instance, HumanPoseTransfer src, Transform lookAtTarget)
            {
                _instance = instance;

                var lookAt = instance.GetComponent <VRMLookAtHead>();

                if (lookAt != null)
                {
                    // vrm
                    _pose            = _instance.gameObject.AddComponent <HumanPoseTransfer>();
                    _pose.Source     = src;
                    _pose.SourceType = HumanPoseTransfer.HumanPoseTransferSourceType.HumanPoseTransfer;

                    m_lipSync = instance.gameObject.AddComponent <AIUEO>();
                    m_blink   = instance.gameObject.AddComponent <Blinker>();

                    lookAt.Target     = lookAtTarget;
                    lookAt.UpdateType = UpdateType.LateUpdate; // after HumanPoseTransfer's setPose

                    m_proxy = instance.GetComponent <VRMBlendShapeProxy>();
                }

                // not vrm
                var animation = instance.GetComponent <Animation>();

                if (animation && animation.clip != null)
                {
                    animation.Play(animation.clip.name);
                }
            }
Beispiel #9
0
    private IEnumerator AnimateEnemyMoves()
    {
        List <Agent> agents = board.world.Agents().FindAll(x => x is Enemy);

        agents = agents.OrderBy(x => x.turnPriority).ToList();
        List <MoveListEnemy> enemies = new List <MoveListEnemy>();

        foreach (Agent a in agents)
        {
            enemies.Add(a as MoveListEnemy);
        }
        foreach (MoveListEnemy e in enemies)
        {
            List <Vector2Int> moves = e.FindNextMoves();
            Blinker           blink = new Blinker();
            Color             color = new Color(e.GetComponent <SpriteRenderer>().color.r, e.GetComponent <SpriteRenderer>().color.g, e.GetComponent <SpriteRenderer>().color.b);
            foreach (Vector2Int move in moves)
            {
                board.tiles[e.position.x + move.x, e.position.y + move.y].GetComponent <GridTile>().Animate(blink, color, true);
                while (board.tiles[e.position.x + move.x, e.position.y + move.y].GetComponent <GridTile>().IsAnimating())
                {
                    yield return(null);
                }
            }
        }
        yield break;
    }
Beispiel #10
0
    void Start()
    {
        RenderTexture r = new RenderTexture(16, 16, 16);
        r.Create();
        GetComponent<Camera>().targetTexture = r;

        blink = FindObjectOfType<Blinker>();
    }
Beispiel #11
0
    // Use this for initialization
    void Start()
    {
        body = GetComponent <Rigidbody2D>();
        TextMesh text = GetComponentInChildren <TextMesh>();

        text.text = letter.ToString().ToUpper();
        blinker   = GetComponent <Blinker>();
    }
Beispiel #12
0
    // Use this for initialization
    void Start()
    {
        //SoundManager.Instance.Play(AudioKey.TitleBGM);
        FadeScript = GameObject.Find("Fade").GetComponent <Fade>();
        Blink      = gameObject.GetComponent <Blinker>();

        fade     = false;
        fade_out = false;
        push     = false;
    }
        public override void Initialize()
        {
            // General section
            VACMAPresent  = GetBoolParameter("General", "VACMAPresent", true);
            RSPresent     = GetBoolParameter("General", "RSPresent", true);
            DAATPresent   = GetBoolParameter("General", "DAATPresent", false);
            TVM300Present = GetBoolParameter("General", "TVM300Present", false);

            // RS section
            RSDelayBeforeEmergencyBrakingS = GetFloatParameter("RS", "DelayBeforeEmergencyBrakingS", 4f);
            RSBlinkerFrequencyHz           = GetFloatParameter("RS", "BlinkerFrequencyHz", 1f);

            // TVM common section
            TVMCOVITInhibited = GetBoolParameter("TVM", "CovitInhibited", false);

            // TVM300 section
            TVM300TrainSpeedLimitMpS = MpS.FromKpH(GetFloatParameter("TVM300", "TrainSpeedLimitKpH", 300f));

            // VACMA section
            VACMAActivationSpeedMpS      = MpS.FromKpH(GetFloatParameter("VACMA", "ActivationSpeedKpH", 3f));
            VACMAReleasedAlertDelayS     = GetFloatParameter("VACMA", "ReleasedAlertDelayS", 2.5f);
            VACMAReleasedEmergencyDelayS = GetFloatParameter("VACMA", "ReleasedEmergencyDelayS", 5f);
            VACMAPressedAlertDelayS      = GetFloatParameter("VACMA", "PressedAlertDelayS", 55f);
            VACMAPressedEmergencyDelayS  = GetFloatParameter("VACMA", "PressedEmergencyDelayS", 60f);

            // Variables initialization
            RSBlinker = new Blinker(this);
            RSBlinker.Setup(RSBlinkerFrequencyHz);
            RSBlinker.Start();
            RSEmergencyTimer = new Timer(this);
            RSEmergencyTimer.Setup(RSDelayBeforeEmergencyBrakingS);
            VACMAPressedAlertTimer = new Timer(this);
            VACMAPressedAlertTimer.Setup(VACMAPressedAlertDelayS);
            VACMAPressedEmergencyTimer = new Timer(this);
            VACMAPressedEmergencyTimer.Setup(VACMAPressedEmergencyDelayS);
            VACMAReleasedAlertTimer = new Timer(this);
            VACMAReleasedAlertTimer.Setup(VACMAReleasedAlertDelayS);
            VACMAReleasedEmergencyTimer = new Timer(this);
            VACMAReleasedEmergencyTimer.Setup(VACMAReleasedEmergencyDelayS);

            // Cabview control names initialization
            SetCustomizedCabviewControlName(BP_AC_SF, "BP (AC) SF : Acquittement / Acknowledge");
            SetCustomizedCabviewControlName(BP_A_LS_SF, "BP (A) LS (SF) : Annulation LS (SF) / Cancel LS (SF)");
            SetCustomizedCabviewControlName(Z_ES_VA, "Z (ES) VA : Essai VACMA / Alerter test");
            SetCustomizedCabviewControlName(BP_AM_V1, "BP AM V1 : Armement manuel TVM voie 1 / TVM manual arming track 1");
            SetCustomizedCabviewControlName(BP_AM_V2, "BP AM V2 : Armement manuel TVM voie 2 / TVM manual arming track 2");
            SetCustomizedCabviewControlName(BP_DM, "BP DM : Désarmement manuel TVM / TVM manual dearming");
            SetCustomizedCabviewControlName(LS_SF, "LS (SF) : Signal Fermé / Closed Signal");
            SetCustomizedCabviewControlName(TVM_Mask, "Masque TVM / TVM mask");

            Activated = true;

            SetNextSignalAspect(Aspect.Clear_1);
        }
Beispiel #14
0
    void Start()
    {
        head.transform.position = new Vector3(0, 2, 0);
        isHoldingMicrophone     = false;
        microphone.SetActive(false);
        rightIndex = 0;
        device     = null;
        if (isLocalPlayer)
        {
            if (UnityEngine.XR.XRSettings.enabled)
            {
                if (SteamVR_Rig == null)
                {
                    GameManager gm = GameObject.Find("GameManager").GetComponent <GameManager>();
                    SteamVR_Rig     = gm.vrCameraRig.transform;
                    hmd             = gm.hmd;
                    controllerLeft  = gm.controllerLeft;
                    controllerRight = gm.controllerRight;
                    hmdBlinker      = gm.hmdBlinker;
                }
                //move the SteamVR_rig to the player's position
                copyTransform(this.transform, SteamVR_Rig.transform);
                //the controllers are the easy ones, just move them directly
                copyTransform(controllerLeft.transform, handLeft.transform);
                copyTransform(controllerRight.transform, handRight.transform);
                //now move the head to the HMD position, this is actually the eye position
                copyTransform(hmd.transform, head);

                //move the feet to be in the tracking space, but on the ground (maybe do this with physics to ensure a good foot position later)
                feet.position = Vector3.Scale(head.position, new Vector3(1, 0, 1)) + Vector3.Scale(SteamVR_Rig.position, new Vector3(0, 1, 0));
                handleControllerInputs();
            }
            else
            {
                float vertical   = Input.GetAxis("Vertical");
                float horizontal = Input.GetAxis("Horizontal");
                transform.Translate(vertical * Time.fixedDeltaTime * (new Vector3(0, 0, 1)));
                transform.Translate(horizontal * Time.fixedDeltaTime * (new Vector3(1, 0, 0)));
            }
            CmdSyncPlayer(head.transform.position, head.transform.rotation, handLeft.transform.position, handLeft.transform.rotation, handRight.transform.position, handRight.transform.rotation);
        }
        else
        {
            //runs on all other clients and  the server
            //move to the syncvars
            head.position = Vector3.Lerp(head.position, headPos, .2f);
            head.rotation = Quaternion.Slerp(head.rotation, headRot, .2f);
            handLeft.transform.position  = leftHandPos;
            handLeft.transform.rotation  = leftHandRot;
            handRight.transform.position = rightHandPos;
            handRight.transform.rotation = rightHandRot;
        }
    }
Beispiel #15
0
        public TimeWidget(GameScene gameScene, float x, float y) : base(x, y)
        {
            this.gameScene = gameScene;
            Layer          = Global.LayerUi;

            label        = new Label(Global.Font);
            label.Scale  = 2.0f;
            label.HAlign = TextAlign.Center;
            Add(label);

            blinker = new Blinker(0.2f, label);
            Add(blinker);
        }
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            listener   = new HearthRateListener();
            lsOperator = LedSoundOperator.GetBlinker();
            var blinker = Blinker.GetBlinker();

            listener.PulseDataReceived += (p, q) =>
            {
                blinker.HeartRate = q.HeartRate;
            };
            blinker.DoBlink += Blinker_DoBlink;
            blinker.Start();
            await listener.Init();
        }
Beispiel #17
0
        private async Task Init()
        {
            if (model == null)
            {
                model = new HeartRateModel();
                await model.Init();

                model.BandDataReceived  += (p, q) => FlashCircle(BandDataCircle, Colors.Gold, 100);
                model.PulseDataReceived += (p, q) => FlashCircle(AzureDataCircle, Colors.Gold, 100);

                var blinker = Blinker.GetBlinker();
                model.PulseDataReceived += (p, q) =>
                {
                    blinker.HeartRate = q.HeartRate;
                };
                blinker.DoBlink += BlinkerDoBlink;
                blinker.Start();
            }
        }
Beispiel #18
0
    void Awake()
    {
        movementAgent    = GetComponent <PlayerMovement>();
        gun              = GetComponent <Gun>();
        blinker          = GetComponent <Blinker>();
        abilityIndicator = GetComponentInChildren <AbilityIndicator>();

        levelSetup = FindObjectOfType <LevelSetup>();
        if (levelSetup)
        {
            levelHasTeleport = levelSetup.teleportActive;
            levelHasEyes     = levelSetup.sightActive;
            levelHasGun      = levelSetup.gunActive;
        }
        else
        {
            levelHasTeleport = levelHasEyes = levelHasGun = true;
        }

        upKey         = keyBinding.moveUp;
        downKey       = keyBinding.moveDown;
        leftKey       = keyBinding.moveLeft;
        rightKey      = keyBinding.moveRight;
        shootKey      = keyBinding.shoot;
        blinkKey      = keyBinding.blink;
        stealGunKey   = keyBinding.stealGun;
        stealEyesKey  = keyBinding.stealEyes;
        stealBlinkKey = keyBinding.stealBlink;

        if (otherPlayer == null)
        {
            var allPlayers = FindObjectsOfType <PlayerInput>();
            if (allPlayers.Length > 1)
            {
                otherPlayer = allPlayers[0] == this ? allPlayers[1] : allPlayers[0];
            }
        }

        if (otherPlayer != null && otherPlayer.playerId == playerId)
        {
            Debug.LogError("SAME PLAYER ID ON PLAYERS OMG");
        }
    }
Beispiel #19
0
    void Solver_OnCollision(object sender, Obi.ObiSolver.ObiCollisionEventArgs e)
    {
        foreach (Oni.Contact c in e.contacts)
        {
            // make sure this is an actual contact:
            if (c.distance < 0.01f)
            {
                // get the collider:
                Collider collider = ObiCollider.idToCollider[c.other] as Collider;

                // make it blink:
                Blinker blinker = collider.GetComponent <Blinker>();

                if (blinker)
                {
                    blinker.Blink();
                }
            }
        }
    }
    public async Task LoadModel(string path)
    {
        if (!File.Exists(path))
        {
            Debug.LogError("file not found path = " + path);
            return;
        }
        //VRMファイルの読み込み
        var bytes   = File.ReadAllBytes(path);
        var context = new VRMImporterContext();

        context.ParseGlb(bytes);
        var meta = context.ReadMeta(false);
        await context.LoadAsyncTask();

        //VRMファイルの表示
        context.ShowMeshes();
        context.EnableUpdateWhenOffscreen();
        context.ShowMeshes();
        model = GameObject.Find("VRM");

        //VRMオブジェクトへの動的アタッチ
        model.AddComponent <AvatarController>();
        this.GetComponent <KinectManager>().ResetAvatarControllers(); //thisをKinectManagerをアタッチしたGameObjectに変更
        //BoneSendへのVRMオブジェクト代入
        this.GetComponent <SampleBonesSend>().Model = model;          //thisをSampleBonesSendをアタッチしたGameObjectに変更
        //BoneReceiveへのVRMオブジェクト代入
        this.GetComponent <SampleBonesReceive>().Model = model;       //thisをSampleBonesSendをアタッチしたGameObjectに変更
        //Blinker追加
        var lookAt = model.GetComponent <VRMLookAtHead>();

        if (lookAt != null)
        {
            model.AddComponent <Blinker>();
            blinker = model.GetComponent <Blinker>();
        }

        //AniLipSync-VRMへのVRMオブジェクト代入
        LipSync.blendShapeProxy = model.GetComponent <VRMBlendShapeProxy>(); //thisをSampleBonesSendをアタッチしたGameObjectに変更
    }
 void Skin_Initialized(object sender, EventArgs e)
 {
     uxSettings       = FindName("uxSettings") as Button;
     uxLeftTurn       = FindName("uxLeftTurn") as Blinker;
     uxRightTurn      = FindName("uxRightTurn") as Blinker;
     uxLowFuel        = FindName("uxLowFuel") as FrameworkElement;
     uxHazard         = FindName("uxHazard") as FrameworkElement;
     uxMalfunction    = FindName("uxMalfunction") as FrameworkElement;
     uxOpenDoor       = FindName("uxOpenDoor") as FrameworkElement;
     uxMessage        = FindName("uxMessage") as TextBlock;
     uxMessageMarquee = FindName("uxMessageMarquee") as Marquee;
     uxOdometer       = FindName("uxOdometer") as TextBlock;
     uxMPG            = FindName("uxMPG") as TextBlock;
     uxMPH            = FindName("uxMPH") as Slider;
     uxRPM            = FindName("uxRPM") as Slider;
     uxFuel           = FindName("uxFuel") as Slider;
     uxTemp           = FindName("uxTemp") as Slider;
     uxOil            = FindName("uxOil") as Slider;
     uxBattery        = FindName("uxBattery") as Slider;
     uxMPHLabel       = FindName("uxMPHLabel") as TextBlock;
     uxRPMLabel       = FindName("uxRPMLabel") as TextBlock;
 }
Beispiel #22
0
        void SetModel(GameObject go)
        {
            // cleanup
            var loaded = m_loaded;

            m_loaded = null;

            if (loaded != null)
            {
                Debug.LogFormat("destroy {0}", loaded);
                GameObject.Destroy(loaded.gameObject);
            }

            if (go != null)
            {
                var lookAt = go.GetComponent <VRMLookAtHead>();
                if (lookAt != null)
                {
                    m_loaded            = go.AddComponent <HumanPoseTransfer>();
                    m_loaded.Source     = m_src;
                    m_loaded.SourceType = HumanPoseTransfer.HumanPoseTransferSourceType.HumanPoseTransfer;

                    m_lipSync = go.AddComponent <AIUEO>();
                    m_blink   = go.AddComponent <Blinker>();

                    lookAt.Target     = m_target.transform;
                    lookAt.UpdateType = UpdateType.LateUpdate; // after HumanPoseTransfer's setPose
                }

                var animation = go.GetComponent <Animation>();
                if (animation && animation.clip != null)
                {
                    animation.Play(animation.clip.name);
                }

                m_proxy = go.GetComponent <VRMBlendShapeProxy>();
            }
        }
Beispiel #23
0
        private static void Main()
        {
            var blinker = new Blinker();

            for (int i = 0; i < 3; i++)
            {
                blinker.Print(new Cell(-1, -2), new Cell(4, 4));
                blinker.Step();
            }

            var glider = new Glider();

            for (int i = 0; i < 3; i++)
            {
                var top    = glider.Top;
                var left   = glider.Left;
                var bottom = glider.Bottom;
                var right  = glider.Right;

                glider.Print(new Cell(left - 1, top - 1), new Cell(right - left + 2, bottom - top + 2));
                glider.Step();
            }
        }
Beispiel #24
0
    static void Main()
    {
        var buffer = new Buffer {
        };

        var blinker = new Blinker {
            SourceBuffer = buffer
        };

        // PowerShell PS> Invoke-WebRequest -Uri "http://try.yaler.net/gsiot-8a3m-5w8t/blinkingPeriod/target" -Method Put -Body 100 -TimeoutSec 2
        var webServer = new HttpServer
        {
            RelayDomain    = Parameters.RelayDomain,
            RelaySecretKey = Parameters.RelaySecretKey,
            RequestRouting =
            {
                {
                    "PUT /blinkingPeriod/target",
                    new ManipulatedVariable
                    {
                        FromHttpRequest =
                            CSharpRepresentation.TryDeserializeInt,
                        ToActuator = buffer.HandlePut
                    }.HandleRequest
                },
                {
                    "GET /blinkingPeriod/target.html",
                    HandleBlinkTargetHtml
                }
            }
        };

        var blinkerThread = new Thread(blinker.Run);

        blinkerThread.Start();
        webServer.Run();
    }
Beispiel #25
0
    static void Main()
    {
        var buffer = new Buffer { };

        var blinker = new Blinker { SourceBuffer = buffer };

        // PowerShell PS> Invoke-WebRequest -Uri "http://try.yaler.net/gsiot-8a3m-5w8t/blinkingPeriod/target" -Method Put -Body 100 -TimeoutSec 2
        var webServer = new HttpServer
        {
            RelayDomain = Parameters.RelayDomain,
            RelaySecretKey = Parameters.RelaySecretKey,
            RequestRouting =
            {
                {
                    "PUT /blinkingPeriod/target",
                    new ManipulatedVariable
                    {
                        FromHttpRequest =
                            CSharpRepresentation.TryDeserializeInt,
                        ToActuator = buffer.HandlePut
                    }.HandleRequest
                },
                {
                    "GET /blinkingPeriod/target.html",
                    HandleBlinkTargetHtml
                }
            }
        };

        var blinkerThread = new Thread(blinker.Run);
        blinkerThread.Start();
        webServer.Run();
    }
 protected override void OnNavigatingFrom(NavigatingCancelEventArgs e)
 {
     lsOperator.Cleanup();
     Blinker.GetBlinker().Stop();
 }
 // Use this for initialization
 void Start()
 {
     boyPosition = this.transform.position;
     blin        = GetComponent <Blinker>();
     blinkSound  = GetComponent <AudioSource>();
 }
Beispiel #28
0
 void Start()
 {
     blinker = new Blinker(this);
 }
Beispiel #29
0
        public Player(PlayerData data, DungeonTile tile, Direction direction)
        {
            Data = data;

            X     = tile.ScreenX + Global.TileSize / 2;
            Y     = tile.ScreenY + Global.TileSize / 2;
            Angle = DirectionUtils.GetAngle(direction);

            Type     = Global.TypePlayer;
            Layer    = Global.LayerMain;
            Collider = data.PixelMask;
            OriginX  = Width / 2;
            OriginY  = Height / 2;

            sortNode = new Renderable();
            Add(sortNode);

            sprite = new Animator(data.Anim);
            sprite.CenterOrigin();
            sprite.Play("idle");
            sortNode.Add(sprite);

            bloodFrontSprite = new Animator(data.Anim);
            bloodFrontSprite.CenterOrigin();
            sortNode.Add(bloodFrontSprite);

            bloodBackSprite = new Animator(data.Anim);
            bloodBackSprite.CenterOrigin();
            sortNode.Add(bloodBackSprite);

            hurtSprite = new Animator(data.Anim);
            hurtSprite.CenterOrigin();
            sortNode.Add(hurtSprite);

            blinker         = new Blinker(PlayerData.InvincibleBlinkInterval, sortNode);
            blinker.Enabled = false;
            Add(blinker);

            if (engineSound == null)
            {
                engineSound = Asset.LoadSoundEffect("sfx/car_engine").CreateInstance();
            }
            engineSound.Volume   = 0.0f;
            engineSound.IsLooped = true;
            engineSound.Play();

            if (driftSounds == null)
            {
                driftSounds = new SoundEffectInstance[2];
                for (var i = 0; i < driftSounds.Length; i++)
                {
                    driftSounds[i]        = Asset.LoadSoundEffect("sfx/car_drift_" + (i + 1)).CreateInstance();
                    driftSounds[i].Volume = 0.7f;
                }
            }

            if (breakSound == null)
            {
                breakSound = Asset.LoadSoundEffect("sfx/car_break").CreateInstance();
            }
            breakSound.Volume = 0.7f;

            Engine.Track(this, "Position");
            Engine.Track(this, "Speed");
            Engine.Track(this, "Angle");
            Engine.Track(this, "engineState");
            Engine.Track(this, "enginePct");
            Engine.Track(this, "driftPct");
            Engine.Track(this, "tireBloodPct");
            Engine.Track(this, "velocity");
            Engine.Track(this, "bounceVelocity");
            Engine.Track(this, "driftAngle");
            Engine.Track(this, "forward");
        }
Beispiel #30
0
 public void Awake()
 {
     itemImage = transform.Find("ItemImage").GetComponent <Image>();
     blinker   = transform.GetComponent <Blinker>();
     UpdateInfo();
 }
        private void btnGen_Click(object sender, EventArgs e)
        {
            try
            {
                if (String.IsNullOrEmpty(tbClassName.Text))
                {
                    Blinker.Blink(tbClassName, Color.Orange, Color.White);
                    return;
                }

                grd.AllowUserToAddRows = false;
                if (grd.Rows.Count > 0)
                {
                    var sb = new StringBuilder();
                    sb.Append("Public Class " + tbClassName.Text + Environment.NewLine);

                    for (int i = 0; i < grd.RowCount; i++)
                    {
                        var pname = GetCellValue(i, FName);
                        var ptype = (String.IsNullOrEmpty(GetCellValue(i, FCustom)) ? GetCellValue(i, FType) : GetCellValue(i, FCustom));
                        if (String.IsNullOrEmpty(pname))
                        {
                            grd.Rows[i].Cells[FName.Index].Style.BackColor          = Color.Orange;
                            grd.Rows[i].Cells[FName.Index].Style.SelectionBackColor = Color.DarkOrange;
                            return;
                        }

                        if (String.IsNullOrEmpty(ptype))
                        {
                            grd.Rows[i].Cells[FType.Index].Style.BackColor            = Color.Orange;
                            grd.Rows[i].Cells[FCustom.Index].Style.BackColor          = Color.Orange;
                            grd.Rows[i].Cells[FCustom.Index].Style.SelectionBackColor = Color.DarkOrange;
                            return;
                        }

                        grd.Rows[i].Cells[FName.Index].Style.BackColor            = Color.White;
                        grd.Rows[i].Cells[FType.Index].Style.BackColor            = Color.White;
                        grd.Rows[i].Cells[FCustom.Index].Style.BackColor          = Color.White;
                        grd.Rows[i].Cells[FCustom.Index].Style.SelectionBackColor = System.Drawing.SystemColors.Highlight;
                        grd.Rows[i].Cells[FName.Index].Style.SelectionBackColor   = System.Drawing.SystemColors.Highlight;

                        sb.Append(String.Format(@"
    Private _{0} As {1}
    Public Property {0}() As {1}
        Get
            Return _{0}
        End Get
        Set(ByVal value As {1})
            _{0} = value
        End Set
    End Property

", pname, ptype));
                    }

                    sb.Append("End Class ");

                    System.IO.File.WriteAllText(System.IO.Path.Combine(Application.StartupPath, tbClassName.Text + ".vb"), sb.ToString());

                    MessageBox.Show("Done");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                grd.AllowUserToAddRows = true;
            }
        }
Beispiel #32
0
        public static ILifePattern ChoosePattern()
        {
            Console.WriteLine("Available pattern:");
            Console.WriteLine("0: GliderGun");
            Console.WriteLine("1: Acorn");
            Console.WriteLine("2: DieHard");
            Console.WriteLine("3: Pentadecathlon");
            Console.WriteLine("4: Pulsar");
            Console.WriteLine("5: Toad");
            Console.WriteLine("6: Beacon");
            Console.WriteLine("7: Blinker");
            Console.WriteLine("8: AcornDoubleMirror");
            Console.WriteLine("9: AcornMirror");
            string choosen        = Console.ReadLine();
            int    patternChoosen = 0;

            if (!string.IsNullOrWhiteSpace(choosen))
            {
                patternChoosen = Convert.ToInt32(choosen);
            }

            ILifePattern pattern;

            switch (patternChoosen)
            {
            case 0:
                pattern = new GliderGun();
                break;

            case 1:
                pattern = new Acorn();
                break;

            case 2:
                pattern = new Diehard();
                break;

            case 3:
                pattern = new Pentadecathlon();
                break;

            case 4:
                pattern = new Pulsar();
                break;

            case 5:
                pattern = new Toad();
                break;

            case 6:
                pattern = new Beacon();
                break;

            case 7:
                pattern = new Blinker();
                break;

            case 8:
                pattern = new AcornDoubleMirror();
                break;

            case 9:
                pattern = new AcornMirror();
                break;

            default:
                pattern = new Acorn();
                break;
            }

            return(pattern);
        }
Beispiel #33
0
 void Start()
 {
     blinky = GetComponent<Blinker> ();
     sound = GetComponent<AudioSource> ();
     gc = GameObject.FindGameObjectWithTag ("GameController").GetComponent<GameController> ();
     aet = GameObject.FindGameObjectWithTag ("Player").GetComponent<AudioEngineThing> ();
     fishy = transform.GetComponent<FishyBehavior> ();
     dead = false;
     isEnemy = false;
     if (this.gameObject.tag == "Enemy")
         isEnemy = true;
 }