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);
    }
 public void Initialize(NinjaBehaviour.NinjaColor ninjaColor, bool useNetwork)
 {
     this.noNetwork = !useNetwork;
     this.color = ninjaColor;
     this.health = maxHealth;
     this.score = 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);
    }
    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);
    }
    void Start()
    {
        ninjaBehaviour = GetComponent<NinjaBehaviour>();
        ninjaWalker = GetComponent<FPSNinjaWalker>();

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

        meshRenderer = GetComponentInChildren <MeshRenderer>();
        if (meshRenderer != null)
        {
            defaultMaterial = meshRenderer.material;
        }
    }
    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);
    }
Beispiel #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;

        }
    }
Beispiel #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;

        }
    }
 public void Start()
 {
     ninjaBehaviour = GetComponent <NinjaBehaviour>();
     pokerAnimation = GetComponentInChildren <NinjaPokerAnimation>();
 }
 // Start is called before the first frame update
 void Start()
 {
     controller = GetComponent <CharacterController>();
     ninja      = FindObjectOfType <NinjaBehaviour>();
 }
 public void Start()
 {
     ninjaBehaviour = GetComponent<NinjaBehaviour>();
     pokerAnimation = GetComponentInChildren<NinjaPokerAnimation>();
 }