Exemplo n.º 1
0
    public void CreateYourBlackClientNinja(Vector3 blackNinjaPosition)
    {
        Debug.Log("WE ARE CREATING A BLACK CLIENT NINJA....");
        const bool instantiateOnNetwork = true;

        localNinja = CreateNinja(NinjaBehaviour.NinjaColor.Black, blackNinjaPosition, instantiateOnNetwork);
    }
Exemplo n.º 2
0
 public void Initialize(NinjaBehaviour.NinjaColor ninjaColor, bool useNetwork)
 {
     this.noNetwork = !useNetwork;
     this.color = ninjaColor;
     this.health = maxHealth;
     this.score = 0;
 }
Exemplo n.º 3
0
    private NinjaLevel LoadSomeLevel(GameObject originalLevel, bool instantiateOnNetwork)
    {
        if (instantiateOnNetwork)
        {
            if (Network.peerType == NetworkPeerType.Server)
            {
                level = FlexiInstantiate <NinjaLevel>(originalLevel, new Vector3(0, 0, 0), Quaternion.identity, instantiateOnNetwork);
                mainCamera.transform.position = level.cameraPosition;
            }
        }
        else
        {
            level = FlexiInstantiate <NinjaLevel>(originalLevel, new Vector3(0, 0, 0), Quaternion.identity, instantiateOnNetwork);
            mainCamera.transform.position = level.cameraPosition;

            localNinja = CreateNinja(NinjaBehaviour.NinjaColor.White, level.whiteNinjaPosition, instantiateOnNetwork);
            CreateNinja(NinjaBehaviour.NinjaColor.Black, level.blackNinjaPosition, instantiateOnNetwork);
        }

        //Set global game state to fighting
        GetComponent <GlobalGameState>().SetFightingState();

        ((GameHUD)FindObjectOfType(typeof(GameHUD))).showMe = true;

        return(level);
    }
Exemplo n.º 4
0
    private NinjaBehaviour CreateNinja(NinjaBehaviour.NinjaColor color, Vector3 position, bool instantiateOnNetwork)
    {
        Debug.Log("Creating " + color + " local");
        NinjaBehaviour ninja = FlexiInstantiate <NinjaBehaviour>(ninjaCharacter, position, Quaternion.identity, instantiateOnNetwork);

        ninja.Initialize(color, instantiateOnNetwork);
        GetComponent <GlobalGameState>().SetFightingState();
        return(ninja);
    }
Exemplo n.º 5
0
    void Start()
    {
        ninjaBehaviour = GetComponent<NinjaBehaviour>();
        ninjaWalker = GetComponent<FPSNinjaWalker>();

        meshRenderer = GetComponentInChildren<MeshRenderer>();
        if (meshRenderer != null)
        {
            defaultMaterial = meshRenderer.material;
        }
    }
Exemplo n.º 6
0
    void Start()
    {
        ninjaBehaviour = GetComponent <NinjaBehaviour>();
        ninjaWalker    = GetComponent <FPSNinjaWalker>();

        meshRenderer = GetComponentInChildren <MeshRenderer>();
        if (meshRenderer != null)
        {
            defaultMaterial = meshRenderer.material;
        }
    }
Exemplo n.º 7
0
    public void OnPlayerConnected(NetworkPlayer player)
    {
        if (localNinja != null)
        {
            //Ninjas already instantiated:
            ServerRespawnGame();
            return;
        }
        const bool instantiateOnNetwork = true;

        localNinja = CreateNinja(NinjaBehaviour.NinjaColor.White, level.whiteNinjaPosition, instantiateOnNetwork);
        networkView.RPC("CreateYourBlackClientNinja", RPCMode.Others, level.blackNinjaPosition);
    }
Exemplo n.º 8
0
    public void SetScore(NinjaBehaviour.NinjaColor color, int score)
    {
        switch(color)
        {
        case NinjaBehaviour.NinjaColor.Black:
            whiteScore = score;
        break;
        case NinjaBehaviour.NinjaColor.White:
            blackScore = score;
        break;

        }
    }
Exemplo n.º 9
0
    public void SetHealth(NinjaBehaviour.NinjaColor color, int health)
    {
        switch(color)
        {
        case NinjaBehaviour.NinjaColor.Black:
            blackHealth = health*10;
        break;
        case NinjaBehaviour.NinjaColor.White:
            whiteHealth = health*10;
        break;

        }
    }
Exemplo n.º 10
0
 public void Start()
 {
     ninjaBehaviour = GetComponent <NinjaBehaviour>();
     pokerAnimation = GetComponentInChildren <NinjaPokerAnimation>();
 }
Exemplo n.º 11
0
 // Start is called before the first frame update
 void Start()
 {
     controller = GetComponent <CharacterController>();
     ninja      = FindObjectOfType <NinjaBehaviour>();
 }
Exemplo n.º 12
0
 public void Start()
 {
     ninjaBehaviour = GetComponent<NinjaBehaviour>();
     pokerAnimation = GetComponentInChildren<NinjaPokerAnimation>();
 }