当前位置: 首页>>代码示例>>C#>>正文


C# PlayerManager.updateScore方法代码示例

本文整理汇总了C#中PlayerManager.updateScore方法的典型用法代码示例。如果您正苦于以下问题:C# PlayerManager.updateScore方法的具体用法?C# PlayerManager.updateScore怎么用?C# PlayerManager.updateScore使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PlayerManager的用法示例。


在下文中一共展示了PlayerManager.updateScore方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnTriggerEnter

    void OnTriggerEnter(Collider other)
    {
        if (Network.isClient)
            return;
        bool hit = false;
        if (universeN() != -1)
        {
            manager = GameObject.Find("Character" + universeN()).GetComponent<PlayerManager>();
            GameObject collided = other.gameObject;
            string collidedTag = collided.tag;
            switch (collidedTag)
            {
                case "EnemyWeapon":
                    Network.Destroy(collided);
                    break;
                case "Enemy":
                    PlayerCollisions.Boom(collided);
                    Network.Destroy(collided);
                    break;
                case "Player":
                    // Player takes damage
                    manager.updateHitPoints(-asteroidDamage * gameObject.transform.localScale.x);
                    // Asteroid explosion effect happens on all clients
                    //networkView.RPC("destroyAfterExplosion", RPCMode.Others);
                    Network.Instantiate(explosion, transform.position, transform.rotation, 200);
                    // Destroy the asteroid everywhere
                    Network.Destroy(gameObject);
                    break;
                case "PlayerBeam":
                    // Do what we want for beam
                    PlayerCollisions.WeaponBoom(gameObject, 1);
                    Network.Destroy(collided);
                    health = health - (WeaponHandler.beamDamage);
                    hit = true;
                    break;
                case "PlayerCannon":
                    // Do what we want for cannon
                    PlayerCollisions.WeaponBoom(gameObject, 2);
                    Network.Destroy(collided);
                    iTween.MoveBy(gameObject, new Vector3(collided.rigidbody.velocity.x / 10, collided.rigidbody.velocity.y / 10, 0), 4f);
                    iTween.RotateAdd(gameObject, new Vector3(50, 50), 5f);
                    hit = true;
                    health = health - (WeaponHandler.cannonDamage);
                    break;
                case "PlayerMine":
                    // Do what we want for mine
                    if (Network.isClient)
                    {
                        for (int i = 0; i < 1; i++)
                        {

                            Transform fragment = (Transform)Instantiate(MineFrag, gameObject.transform.position, Random.rotation);
                            fragment.name = "MineFragment";
                            Physics.IgnoreCollision(fragment.collider, gameObject.collider);
                            fragment.rigidbody.AddForce((Random.insideUnitSphere.normalized * 2) * force);
                        }
                        for (int i = 0; i < 1; i++)
                        {
                            Transform fragment = (Transform)Instantiate(MineFrag, gameObject.transform.position, Random.rotation);
                            fragment.name = "Mine Fragment";
                            Physics.IgnoreCollision(fragment.collider, gameObject.collider);
                            fragment.rigidbody.AddForce((Random.insideUnitCircle.normalized) * force);
                        }

                    }
                    Network.Destroy(collided);
                    hit = true;
                    health = health - (WeaponHandler.mineDamage);

                    break;
                case "MineFrag":
                    health = health - (WeaponHandler.mineFragmentDamage);
                    Network.Destroy(collided);
                    hit = true;
                    break;
                default:
                    break;
            }
            if (health <= 0 && hit)
            {
                int scoreAddition = (int)(100 * transform.localScale.x);
                manager.updateScore(scoreAddition);
                networkView.RPC("scoreXP", RPCMode.All, universeN(), scoreAddition);
                Network.Instantiate(explosion, transform.position, transform.rotation, 0);
                Network.Destroy(gameObject);
            }
        }
    }
开发者ID:jamiehenson,项目名称:STR,代码行数:88,代码来源:AsteroidCollisions.cs


注:本文中的PlayerManager.updateScore方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。