Exemplo n.º 1
0
 void OnCollisionEnter(Collision collision)
 {
     if (collision.gameObject.tag == "Face") {
         collision.gameObject.BroadcastMessage("BeginAnimation", score > 0 ? "smile" : "anger");
         if (scorekeeperReference == null) {
             scorekeeperReference = FindObjectOfType<Scorekeeper>();
         }
         if (scorekeeperReference != null) {
             scorekeeperReference.AddSubScore(score);
         }
     }
 }
Exemplo n.º 2
0
    // Sets up lobby GUI
    public void OnGUI()
    {
        scorekeeper = GameObject.Find ("Scorekeeper").GetComponent<Scorekeeper>();

        // Make menu
        Rect content = new Rect((Screen.width - this.widthAndHeight.x)/2, (Screen.height - this.widthAndHeight.y)/2, this.widthAndHeight.x, this.widthAndHeight.y);
        GUILayout.Space(20);
        GUI.Box(content, "Game Over");
        GUILayout.BeginArea(content);
        GUILayout.FlexibleSpace();

        // Make player scores
        GUILayout.BeginHorizontal();
        GUILayout.Space(150);
        GUILayout.Label("Standings");
        GUILayout.EndHorizontal();
        PhotonPlayer[] players = PhotonNetwork.playerList;
        for ( int i = 0; i < players.Length; i++ )
        {
            GUILayout.BeginHorizontal();
            GUILayout.Space(150);
            if (PhotonNetwork.offlineMode) {
                GUILayout.Label("Your score: ", GUILayout.Width(180));
            }
            else {
                GUILayout.Label(players[i].name, GUILayout.Width(180));
            }
            GUILayout.FlexibleSpace();
            GUILayout.Label(scorekeeper.getScore(players[i].ID) + " fame points", GUILayout.Width(100));
            GUILayout.Space(150);
            GUILayout.EndHorizontal();
        }
        GUILayout.FlexibleSpace();

        // main menu button
        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        if (GUILayout.Button("Main Menu", GUILayout.Width(125)))
        {
            scorekeeper = GameObject.Find ("Scorekeeper").GetComponent<Scorekeeper>();
            scorekeeper.clearScore();
            PhotonNetwork.LeaveRoom();
            PhotonNetwork.Disconnect();
            PhotonNetwork.LoadLevel(0);
        }
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();
        GUILayout.Space(30);

        GUILayout.EndArea();
    }
Exemplo n.º 3
0
    public void MakeTombstone()
    {
        Scorekeeper score = gameObject.GetComponent <Scorekeeper> ();

        if (score.CanBuy(tombstonePrice))
        {
            score.AddScore(-tombstonePrice);
            Instantiate(tombstone);
        }
        else
        {
            Debug.Log("Not enough money for a tombstone.");
        }
    }
Exemplo n.º 4
0
    void Awake()
    {
        //请记分员
        scorekeeper = Scorekeeper.getInstance();
        scorekeeper.sceneController = this;
        //请patrol工厂
        patrolFactory = PatrolFactory.getInstance();
        patrolFactory.sceneController = this;
        //导演
        SSDirector director = SSDirector.getInstance();

        director.setFPS(60);
        director.currentSceneController = this;
        director.currentSceneController.LoadResources();
    }
Exemplo n.º 5
0
    void OnTriggerEnter2D(Collider2D col)
    {
        Laser missile = col.GetComponent <Laser>();

        if (missile && col.name == "Enemy Laser Shot")
        {
            health -= missile.GetDamage();
            missile.Hit();
            if (health <= 0)
            {
                Scorekeeper.Reset();
                Destroy(gameObject);
            }
        }
    }
Exemplo n.º 6
0
    //initialization
    void Start()
    {
        //get cannon elements
        tip         = GameObject.Find("Tip");
        mesh        = GameObject.Find("Mesh");
        line        = GameObject.Find("CannonLine").GetComponent <LineRenderer>();
        audio       = GameObject.Find("AudioController").GetComponent <AudioController>();
        scorer      = GameObject.Find("UI").GetComponent <Scorekeeper>();
        camControls = GameObject.Find("Main Camera").GetComponent <CameraRotation>();
        camPosition = GameObject.Find("Main Camera").transform.position;
        camRotation = GameObject.Find("Main Camera").transform.rotation;

        //position elements according to master gameobject
        tip.transform.position = new Vector3(0, tipOffset, 0);
    }
Exemplo n.º 7
0
 void OnCollisionEnter(Collision collision)
 {
     if (collision.gameObject.tag == "Face")
     {
         collision.gameObject.BroadcastMessage("BeginAnimation", score > 0 ? "smile" : "anger");
         if (scorekeeperReference == null)
         {
             scorekeeperReference = FindObjectOfType <Scorekeeper>();
         }
         if (scorekeeperReference != null)
         {
             scorekeeperReference.AddSubScore(score);
         }
     }
 }
Exemplo n.º 8
0
    void Start()
    {
        sounds      = GetComponents <AudioSource>();
        totalHealth = health;
        scoreValue  = (int)(totalHealth * 1.25);
        Vector3 startVector = new Vector3(0f, 0.6f, 0f);

        healthBar = Instantiate(healthBarObject, this.transform.position + startVector, Quaternion.identity) as GameObject;
        healthBar.transform.parent = this.transform;
        healthBar.transform.Rotate(new Vector3(0f, 0f, 90f));

        scoreKeeper = GameObject.Find("Score").GetComponent <Scorekeeper>();
        shootLaser  = sounds [0];
        shipExplode = sounds [1].clip;
    }
        // Simplified Interfaces expressing the Domain Model
        // (int runs, int wickets, int overs) GetInningsScore(int InningsNum) - returns a tuple run for wickets in overs
        // int runs GetBatsmanScore(BatsmanName)
        // string status GetBatsmanStatus(BatsmanName)
        // (int overs, int maidens, int runs, int wickets) GetBowlerStats(BowlerName)
        // string[] GetBatsmenNames(InningsNum)
        // string[] GetBowlerNames(InningsNum)
        // int GetNumberOfInnings()
        // void SubmitTeam(int teamID, string[] batsmenNames)
        // void ChangeBowler(int teamID, string bowlerName)
        // TODO : End of Innings - where do I put logic in keeper or card?


        public scorekeeperTests()
        {
            _keeper = new Scorekeeper(ONE_DAY);
            _keeper.SubmitTeam(0, new string[] { "Ian Botham",
                                                 "David Gower",
                                                 "Michael Vaughan",
                                                 "Kevin Pietersen",
                                                 "Freddie Flintoff",
                                                 "Jos Buttler",
                                                 "Ben Stokes",
                                                 "Johnny Bairstow",
                                                 "Stuart Broad",
                                                 "Graham Swann",
                                                 "James Anderson" });
            _keeper.ChangeBowler("Michael Holding");
        }
Exemplo n.º 10
0
    void OnTriggerEnter2D(Collider2D col)
    {
        PlayerController player = col.gameObject.GetComponent <PlayerController> ();

        if (player && !player.shield)
        {
            player.shield       = true;
            player.shieldObject = Instantiate(shieldPrefab, this.transform.position, Quaternion.identity) as GameObject;
            Destroy(gameObject);
        }
        else if (player && player.shield)
        {
            Scorekeeper scoreKeeper = GameObject.Find("Score").GetComponent <Scorekeeper> ();
            scoreKeeper.Score(50);
            Destroy(gameObject);
        }
    }
Exemplo n.º 11
0
    public void Start()
    {
        scorekeeper = GameObject.Find ("Scorekeeper").GetComponent<Scorekeeper>();
        // sets up tooltip text
        player = "PLAYER:   " + this.photonView.owner.name ;
        string fame =  "\nFAME:   ";
        toolTipText = player + fame;

        // sets up tooltip
        guiStyleFore = new GUIStyle();
        guiStyleFore.normal.textColor = Color.white;
        guiStyleFore.alignment = TextAnchor.UpperCenter ;
        guiStyleFore.wordWrap = true;
        guiStyleBack = new GUIStyle();
        guiStyleBack.normal.textColor = Color.black;
        guiStyleBack.alignment = TextAnchor.UpperCenter ;
        guiStyleBack.wordWrap = true;
    }
Exemplo n.º 12
0
    public void PlayerDeath()
    {
        playerLives -= 1;
        lifeDisplayPanel.RemoveLife();

        if (audioSource)
        {
            audioSource.PlayOneShot(playerDeathClip);
        }

        if (playerLives > 0)
        {
            RespawnPlayer();
        }
        else
        {
            Scorekeeper.GameOver();
        }
    }
Exemplo n.º 13
0
 void Start()
 {
     if (instance == null)
     {
         // save this instance
         instance = this;
     }
     else
     {
         // more than one instance exists
         Debug.LogError(
             "More than one Scorekeeper exists in the scene.");
     }
     // reset the scores to zero
     for (int i = 0; i < score.Length; i++)
     {
         score[i]          = 0;
         scoreText[i].text = "0";
     }
 }
Exemplo n.º 14
0
    private void OnParticleCollision(UnityEngine.GameObject other)
    {
        score = FindObjectOfType <Scorekeeper>();

        audioSource = GetComponent <AudioSource>();

        blood.Play();
        audioSource.PlayOneShot(arrowImpactSFX);

        if (healthPoints > 1)
        {
            healthPoints--;
        }
        else
        {
            score.ScoreIncrease();

            DeathFX();

            Instantiate(deathSFXPrefab, transform.position, Quaternion.identity);

            Destroy(gameObject);
        }
    }
Exemplo n.º 15
0
    public Text resultText2; //Text用変数

    void Start()
    {
        scorekeeper = (Scorekeeper)GetComponent(typeof(Scorekeeper));
    }
Exemplo n.º 16
0
 private void OnDisable()
 {
     Scorekeeper.EnemyDestroyed();
 }
Exemplo n.º 17
0
 void Start()
 {
     collectSound = GetComponent <AudioSource>();
     raccoonArm   = GameObject.Find("ClawArm");
     scorekeeper  = GameObject.Find("MasterScorekeeper").GetComponent <Scorekeeper>();
 }
Exemplo n.º 18
0
 void Die()
 {
     AudioSource.PlayClipAtPoint(deathSound, transform.position);
     Scorekeeper.Score(10);
     Destroy(gameObject);
 }
Exemplo n.º 19
0
 private void OnEnable()
 {
     Scorekeeper.EnemySpawned();
     body.velocity = velocity * trans.up;
 }
Exemplo n.º 20
0
 private void BeginMatch()
 {
     Scorekeeper.SetMatchState(MatchState.AUTONOMOUS);
     PlaySound(matchStart);
     hasPlayedMatchStart = true;
 }
Exemplo n.º 21
0
 void Start()
 {
     score = GetComponent<Scorekeeper> ();
 }
 void Start()
 {
     scorekeeper = (Scorekeeper)GameObject.FindObjectOfType(typeof(Scorekeeper));
 }
Exemplo n.º 23
0
 private void Start()
 {
     SpawnInitialPlayer();
     Scorekeeper.NewGame();
 }
Exemplo n.º 24
0
 private void OnDestroy()
 {
     Scorekeeper.AddScore(scoreValue);
 }
Exemplo n.º 25
0
 private void Awake()
 {
     sk = FindObjectOfType <Scorekeeper>();
 }
Exemplo n.º 26
0
    // Use this for initialization
    void Start()
    {
        menuAudio = GameObject.Find ("GUI Background").GetComponent<MenuAudio> ();
        scorekeeper = GameObject.Find ("Scorekeeper").GetComponent<Scorekeeper>();
        photonView.RPC("SetScore", PhotonTargets.AllBuffered, PhotonNetwork.player.ID, 0);

        overlayCanvas = transform.GetComponentsInChildren<Canvas>().First(x => x.gameObject.name == "Common Area Overlay");
        mainCanvas = transform.GetComponentsInChildren<Canvas>().First(x => x.gameObject.name == "Main Canvas");
        handCanvas = transform.GetComponentsInChildren<Canvas>().First(x => x.gameObject.name == "Hand Canvas");

        // disables our overlay for other people, so they do not see our score, move, and other values
        if(photonView.isMine)
        {
            overlayCanvas.enabled = true;
            mainCanvas.enabled = true;
            photonView.RPC("DisableCanvas", PhotonTargets.OthersBuffered, overlayCanvas.gameObject.GetPhotonView().viewID);
            photonView.RPC("DisableCanvas", PhotonTargets.OthersBuffered, mainCanvas.gameObject.GetPhotonView().viewID);
            photonView.RPC("DisableCanvas", PhotonTargets.OthersBuffered, handCanvas.gameObject.GetPhotonView().viewID);

        }

        handSizeIncreaseLevels = new int[3]{10, 25, 50};
        turnPhase = Toolbox.TurnPhase.Move;
        handCamera = GameObject.Find ("Hand Camera").GetComponent<Camera>();
        mainCamera = GameObject.Find ("Main Camera").GetComponent<Camera>();
        handCanvas.worldCamera = handCamera;
        mainCanvas.worldCamera = mainCamera;
        mainCanvas.transform.GetComponentsInChildren<Button>().First(x => x.gameObject.name == "View Hand Button").onClick.AddListener(() => { ArrangeHand(0); });
        mainCanvas.transform.GetComponentsInChildren<Button>().First(x => x.gameObject.name == "View Hand Button").onClick.AddListener(() => { Manager.ChangeCameras("Hand"); });
        handCanvas.transform.GetComponentsInChildren<Button>().First(x => x.gameObject.name == "Return To Game Button").onClick.AddListener(() => { Manager.ChangeCameras("Main"); });
        handCanvas.transform.GetComponentsInChildren<Button>().First(x => x.gameObject.name == "View Next").onClick.AddListener(() => { ArrangeHand(1); });
        handCanvas.transform.GetComponentsInChildren<Button>().First(x => x.gameObject.name == "View Prev").onClick.AddListener(() => { ArrangeHand(-1); });
        player = transform.GetChild (0);
        //portal hex is the seventh child of green tile zero.
        portalHex = GameObject.Find("Green Tile 0").transform.GetChild(6).gameObject;
        destroyedCards = GameObject.Find ("Destroyed Cards");
        onHex = portalHex.GetComponent<HexScript>();
        player.position = portalHex.transform.position;
        attackLabel = GetComponentInChildren<Canvas>().transform.GetComponentsInChildren<Text>().First(x => x.gameObject.name == "Attack Label").gameObject;
        blockLabel = GetComponentInChildren<Canvas>().transform.GetComponentsInChildren<Text>().First(x => x.gameObject.name == "Block Label").gameObject;
        timerLabel = GetComponentInChildren<Canvas>().transform.GetComponentsInChildren<Text>().First(x => x.gameObject.name == "Timer").gameObject;
        retreatLabel = GetComponentInChildren<Canvas>().transform.GetComponentsInChildren<Text>().First(x => x.gameObject.name == "Retreat Label").gameObject;
        usesLabel = GetComponentInChildren<Canvas>().transform.GetComponentsInChildren<Text>().First(x => x.gameObject.name == "Uses Remaining").gameObject;
        turnPhaseLabel = mainCanvas.transform.GetComponentsInChildren<Text>().First(x => x.gameObject.name == "Phase Label").gameObject;
        deckSizeLabel = GetComponentInChildren<Canvas>().transform.GetComponentsInChildren<Text>().First(x => x.gameObject.name == "Deck Size Label").gameObject;
        attackLabel.SetActive(false);
        blockLabel.SetActive(false);
        hand = handCanvas.transform.GetComponentsInChildren<Transform>().First(x => x.gameObject.name == "Hand").gameObject;
        deck = transform.GetComponentsInChildren<Transform>().First (x => x.gameObject.name == "Deed Deck").gameObject;
        energyLabel = transform.GetComponentsInChildren<Transform>().First (x => x.gameObject.name == "Energy Label").gameObject;
        handSizeLabel = transform.GetComponentsInChildren<Transform>().First (x => x.gameObject.name == "Hand Size Label").gameObject;
        armorLabel = transform.GetComponentsInChildren<Transform>().First (x => x.gameObject.name == "Armor Label").gameObject;
        fameLabel = transform.GetComponentsInChildren<Transform>().First (x => x.gameObject.name == "Fame Track").gameObject;
        discardPile = transform.GetComponentsInChildren<Transform>().First (x => x.gameObject.name == "Discard Pile").gameObject;
        InitDeckAndHand();
        ArrangeHand(0);
        endMovesButton = mainCanvas.transform.GetComponentsInChildren<Button>().First(x => x.gameObject.name == "End Move Button");
        endMovesButton.onClick.AddListener(() => Manager.SwitchToTurnPhase(Toolbox.TurnPhase.Action));
        endActionButton = mainCanvas.transform.GetComponentsInChildren<Button>().First(x => x.gameObject.name == "End Action Button");
        endActionButton.onClick.AddListener(() => Manager.SwitchToTurnPhase(Toolbox.TurnPhase.End));
        interactButton = mainCanvas.transform.GetComponentsInChildren<Button>().First(x => x.gameObject.name == "Interaction Button");
        interactButton.onClick.AddListener(() => PrepInteractionMenu());
        restButton = mainCanvas.transform.GetComponentsInChildren<Button>().First(x => x.gameObject.name == "Rest Button");
        restButton.onClick.AddListener(() => DoRest());
        provokeButton = mainCanvas.transform.GetComponentsInChildren<Button>().First(x => x.gameObject.name == "Provoke Button");
        provokeButton.onClick.AddListener(() => ProvokeRampagers());
        ShowProvokeButton(false);
        ShowRestButton(false);
        ShowInteractionButton(false);
        ShowActionButton(false);
        UpdateLabels();
    }
 void Start()
 {
     scoreKeep = GameObject.Find("Score").GetComponent <Scorekeeper> ();
 }
Exemplo n.º 28
0
    //initialization
    void Start()
    {
        //get elements
        tip    = GameObject.Find("Tip");
        mesh   = GameObject.Find("Mesh");
        audio  = GameObject.Find("AudioController").GetComponent <AudioController>();
        scorer = GameObject.Find("UI").GetComponent <Scorekeeper>();
        rb     = GetComponent <Rigidbody>();

        //assign random color
        int random = Random.Range(0, 3);

        switch (random)
        {
        case 0:
            color = "green";
            GetComponent <Renderer>().material = Resources.Load("Green Bubble", typeof(Material)) as Material;
            break;

        case 1:
            color = "blue";
            GetComponent <Renderer>().material = Resources.Load("Blue Bubble", typeof(Material)) as Material;
            break;

        case 2:
            color = "red";
            GetComponent <Renderer>().material = Resources.Load("Red Bubble", typeof(Material)) as Material;
            break;
        }

        //assign whether or not it's a heavy body
        random = Random.Range(0, 10);
        if (random > 7)
        {
            isHeavy = true;
        }
        else
        {
            isHeavy = false;
        }

        //give random mass
        float newMass = Random.Range(massMin, massMax);

        rb.mass = newMass;
        mass    = newMass;

        //give appropriate size
        transform.localScale = new Vector3(newMass / 5, newMass / 5, newMass / 5);

        //set falloff according to mass
        falloff = newMass * 10;

        //give outline if isHeavy
        if (isHeavy)
        {
            GetComponent <Renderer>().material.SetFloat("_OutlineWidth", 0.4f);
        }
        else
        {
            GetComponent <Renderer>().material.SetFloat("_OutlineWidth", 0.0f);
            rb.drag = 0;
        }

        //set lifespan
        lifespan = 20000;
        life     = lifespan;
    }
Exemplo n.º 29
0
 // Use this for initialization
 void Start()
 {
     scorekeeper = FindObjectOfType <Scorekeeper>();
     text        = GetComponent <Text>();
 }
 private void Awake()
 {
     scoreKeeper = GameObject.FindGameObjectWithTag("Scorekeeper").GetComponent <Scorekeeper>();
 }
Exemplo n.º 31
0
 void Start()
 {
     body        = GetComponent <Rigidbody>();
     scorekeeper = FieldProperties.FIELD.GetComponent <Scorekeeper>();
 }
Exemplo n.º 32
0
 // Use this for initialization
 void Start()
 {
     text      = GetComponent <Text> ();
     text.text = Scorekeeper.totalPoints.ToString();
     Scorekeeper.Reset();
 }
Exemplo n.º 33
0
 // Use this for initialization
 void Start()
 {
     //Scorekeeperコンポーネントへの参照を取得する
     scorekeeper = GetComponent <Scorekeeper>();
 }
Exemplo n.º 34
0
 void Start()
 {
     score = GetComponent <Scorekeeper> ();
 }
Exemplo n.º 35
0
 void DelayedSpawn()
 {
     Scorekeeper.EnemyDestroyed();
     DoSpawn();
 }